The Item class mixes in Traversable, which is probably responsible for making this work TTW. It also gives you a bunch of other stuff that many Zope classes need, like DAV support, copy support, ZMI tab support and security. It doen't mix-in acquisition tho. If you need support for acquistion machinery (including __of__ which creates wrappers), then you need to mix-in Acquisition.Implicit. The SimpleItem class mixes this and Persistence in for you (along with Item), so many Zope classes derive form SimpleItem. You need Persistence to store instances of your class in the ZODB, and implicit acquisition is the standard for Zope objects. In short I would recommend mixing in SimpleItem or you may find that your objects are not stored properly in the ZODB. -Casey BTW: People will take you a lot more seriously on this list if you loose the #{{{ ... #}}} crutches ;^) On Wednesday 14 August 2002 05:29 pm, Joachim Schmitz wrote:
Hi,
in my AixtraTable product the newItem method is defined like this:
def newItem(self,key): #{{{ "returns item" data = self._items if data.has_key(key): return None else: item = makeItem(key,self.FieldList) data[key] = item self.catalog_object(item) return data[key] #}}}
where self._items is:
self._items = OOBTree()
and the makeItem-Class is:
class makeItem(Item): #{{{ """ AixtraTable Item class
""" def __init__(self, key, fieldlist): self.id = key for f in fieldlist: setattr(self,f,"")
#}}}
it only worked, when I inherited from Item, otherwise I could not access the items from the web, my guess is, cause they had no acquisition wrappers. Can I achieve the same with the __of__ magic and how ?
you can download the product from http://www.zope.org/Members/perry/AixtraTable
Mit freundlichen Grüßen Joachim Schmitz -------------------------------------------------------------------- AixtraWare Ingenieurbüro für Internetanwendungen Hüsgenstr. 33a, D-52457 Aldenhoven Telefon: +49-2464-8851, FAX: +49-2464-905163 -------------------------------------------------------------------- Key fingerprint = DA10 CC82 62F8 1DBB 39A1 1EDC 725B 3317 A8D7 C3A6 Keyserver: http://www.keyserver.net/en/
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )