[ZPT] Using PTFiles in Python Products

Chris Withers chrisw@nipltd.com
Sat, 13 Jul 2002 12:24:19 +0100


"Michael R. Bernstein" wrote:
> 
>             # retreive contained object if it exists
>             print "object is not int-like " + name
>             if name in self.objectIds():
>                 print "returning contained object " + name
>                 return getattr(self, name)
>             # return attribute (if no matching contained object is
>             # found).
>             elif hasattr(self, name):
>                 print "returning object attribute " + name
>                 return getattr(self, name)

These two return statements don't do any acquisition wrapping, maybe they
should?
Probably not but it might be worth a try...

>             else:
>                 # return object stored in BTree
>                 print "returning object in BTree " + name
>                 return self.Postings[name].__of__(self)
>         print "returning weblog object " + name
>         return self

what case does this 'return self' handle?

cheers,

Chris