[Erp5-dev] Monkey Patching problem
Łukasz Nowak
lukasz.nowak at ventis.com.pl
Tue Sep 4 17:55:28 CEST 2007
Hello,
On 2007-09-04, 16:41:21
Romain Courteaud <romain at nexedi.com> wrote:
> * ??ukasz Nowak [2007-09-04 16:06:31 +0200]:
>
> > So... shall I do from Products.ERP5Type.Document.Resource import
> > Resource? It is not working (ImportError: No module named
> > Resource). So clue is in "but this is only after ERP5Type is
> > initialized." - how wait/hook into it? Any code snippet to achieve
> > it?
>
> So, in this case, you have to use portal_classes to surcharge the
> Document like this:
>
> from Products.ERP5Type.Document.Resource import Resource as
> ERP5Resource class Resource(ERP5Resource):
> def foo(...)
Ha! Got it! Thanks. Wouldn't be nice to put that information on wiki,
with nice explanations and so on - by experienced developer? I know,
that one shall not monkey patch ERP5, but sometimes it is only solution
(for now we were using something like patch-o-matic in Ventis, to patch
source code).
Regards,
Luke
--
Łukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...''
More information about the Erp5-dev
mailing list