Hello,
I don't understand property behawiour in code bellow (I am not
experienced programmmer, so I could missed something obivious).
In example bellow: "list_items1" works as I expected - it returns
list of objects from catalog but "list_items2" fails - I get Attribute
Error or if it finds "items" through acquisition it returns this object.
But, if I uncomment line "return [1,2,3]" in code below, then both
functions return the same value - list [1,2,3].
Search of "catalog" by acquisition messes with class attribute lookup?
<code>
class Storage (SimpleItem):
""" see IStorage interface """
implements(IStorage)
title = FieldProperty(IStorage['title'])
description = FieldProperty(IStorage['description'])
def _get_items(self):
""" Return list of items in storage (unsorted). """
#return [1,2,3]
return [x.getObject() for x in self.catalog(storage=self.title)]
items = property(_get_items)
def list_items1(self):
""" test """
return self._get_items()
def list_items2(self):
""" test """
return self.items
</code>
Piotr Chamera
_______________________________________________
Zope maillist - [email protected]
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 )