[Zope] Strange behavior in folderish class

Dylan Reinhardt zope@dylanreinhardt.com
Thu, 06 Feb 2003 08:31:05 -0800


It's tough to fill in the blanks, but here goes:

I'm assuming that myMethod is associated with index_html?  If not, what 
*are* you calling and how?

How is id generated?  Do you type it in your manage_addMyClass form or is 
it generated by some more clever means... something that persists 
information between instances, perhaps?  Might it be a combination of the two?

What if you copy & pasted instance B to be in the same container as A and call:

http://mysite/myClassInstaceB

What does that give you?

My first guess here would be that you goofed somehow and have derived id 
from something that's remained constant between instances... a class 
variable or an argument default, perhaps.  My second guess would be that 
you're not actually calling myMethod, but something else entirely.  A 
distant third would be that somehow you're not assigning instance B an id 
at all... that might cause id to be acquired from its parent.

Does any of this reveal any new information?

Dylan



At 12:10 AM 2/6/2003, Daniel Talas wrote:
>Howdy -
>
>I have a python product, with a simple class MyClass derived from 
>Folder.  It has a simple
>method myMethod with the following code:
>
>def myMethod(self):
>     return self.id
>
>
>I have several nested instances of myClass on my site, but here is a
>simplest case:
>
>myClassInstanceA
>    |
>    |__myClassInstanceB
>
>
>I also have a simple template (zpt), with the following code:
>
><span tal:content="here/myMethod"/>
>
>Here is the problem:  when I go to
>http://mysite/myClassInstanceA/myClassInstaceB, the output of my zpt
>is always 'myClassInstanceA', where I would expect it to be
>'myClassInstanceB'.  What am I missing?  Do I need to do more than
>just inherit from Folder class?  Do I need anything special in my
>__init__ method?
>
>Thanks,
>Daniel.
>
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://mail.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )