I'm trying to emulate some DTML methods with python code in my (python) product.
 
Let's say I have two Python classes, one named Foo, the other Bar.  Something like this:
 
class Foo(Folder.Folder, Persistent, Implicit):
    meta_type = "Foo"
 
    def magic(self, client=None):
        "magic method!"
 
        if client == None:
            client = self
 
        return client.magic_word
 
class Bar(Folder.Folder, Persistent, Implicit):
    meta_type = "Bar"
 
    def __init__(self, id):
        self.id = id
        self.magic_word = 'Alacazam!"
 
 
Now I create a structure like this in Zope:
 
/
    foo    (instance of the Foo class)
    bar    (instance of the Bar class)
 
Now if I goto /bar/foo/magic, I see the magic word.  However, I would also like to use /foo/bar/magic, and also receive the magic word.  This latter case doesn't work, the magic_word isn't set.
 
In fact, the "client" argument is never anything but None.
 
This is a facet of Zope I still don't quite understand...
 
Thanks,
-Randy

Reply via email to