[ZPT] Calling complex product tags from ZPT

Richard Jones rjones@ekit-inc.com
Sun, 14 Jul 2002 16:17:10 +1000


On Sun, 14 Jul 2002 4:10 pm, J C Lawrence wrote:
> On Sun, 07 Jul 2002 18:56:30 +0200
>
> j-david  <ISO-8859-1> wrote:
> > J C Lawrence wrote:
> >> On Sun, 07 Jul 2002 17:12:23 +0200 j-david <ISO-8859-1> wrote:
> >
> > I use a really primitive way to debug, which is enough most of the
> > time. Just modify NuxWidgets to output a message in the right
> > places. For example, in NuxWidgets.__init__.py, add the following line
> > at the beginning of pt_getContext:
> >
> >   open('/tmp/kk', 'w').write('pt_getContext from NuxWidgets\n')
>
> I went a little further than that:
>
> --<cut>--
> def pt_getContext(self):
>     """
>     New "pt_getContext" method, adds the "widgets" name.
>     """
>
>     c = self.pt_getContext_old()
>     c['widgets'] = widgets
>     open('/tmp/t.t', 'a').write('pt_getContext from NuxWidgets\n')
>
>     return c

Hrm - I'm coming in on the tail end of this - but it might be that the 
CallProfiler can help here. The latest version can patch arbitrary methods 
for monitoring. No need to write your own patcher manually :)

Down side is that there hasn't been a stand-alone release since it was 
incorporated into the Zope 2.6 codebase. I should remedy that, next time I 
have some spare .. time :)


    Richard