[Zope-dev] two hard questions
Casey Duncan
c.duncan@nlada.org
Wed, 6 Mar 2002 09:30:04 -0500
On Wednesday 06 March 2002 07:27 am, Tim McLaughlin allegedly wrote:
> Firstly, I'm trying to return a lazy list to a dtml-in, but it seems
> that the __getitems__ are all called up front.... This is the class and
> the print statement shows up in debugging before any debugging output
> from within the dtml-in:
[snip code]
> Does this mean that dmtl-in touches all of the objects first for some
> reason? Or am I missing something?
My guess is that you have a sort attribute on your dtml-in, which would touch
everything in the sequence up front.
> Second hard ?..... Is there any way to wrap a Folder subclassed
> instance within another class so that I can override some methods on an
> instance by instance basis? I tried doing a .__class__ replacement, but
> for whatever reason, Zope machinery seems to keep it from taking effect.
> Any ideas? I've tried about 5 different approaches to no avail :(
I'm not sure how (or why) you would wrap a class around an instance. In order
to override methods on an instance by instance basis, you would most probably
need to create a object proxy wrapper that override __getattr__ so that it
can fire off the right methods.
If these methods are accessed TTW, then you could just use __bobo_traverse__
for this too.
Maybe restate the problem in a different way.
/---------------------------------------------------\
Casey Duncan, Sr. Web Developer
National Legal Aid and Defender Association
c.duncan@nlada.org
\---------------------------------------------------/