[Zope-dev] to __of__ or not to __of__ ?

Joachim Schmitz js@aixtraware.de
Wed, 14 Aug 2002 23:29:20 +0200


Hi,

in my AixtraTable product the newItem method is defined like this:

    def newItem(self,key): #{{{
	"returns item"
	data =3D self._items
	if data.has_key(key):
	    return None
	else:
	    item =3D makeItem(key,self.FieldList)
	    data[key] =3D item
	    self.catalog_object(item)
	    return data[key]
    #}}}

where self._items is:

	self._items =3D OOBTree()


and the makeItem-Class is:

class makeItem(Item): #{{{
    """
    AixtraTable Item class

    """
    def __init__(self, key, fieldlist):
	self.id =3D key
	for f in fieldlist:
	    setattr(self,f,"")

#}}}

it only worked, when I inherited from Item, otherwise I could not access=20
the items from the web, my guess is, cause they had no acquisition=20
wrappers. Can I achieve the same with the __of__ magic and how ?

you can download the product from=20
http://www.zope.org/Members/perry/AixtraTable




Mit freundlichen Gr=FC=DFen                              Joachim Schmitz
--------------------------------------------------------------------
AixtraWare Ingenieurb=FCro f=FCr Internetanwendungen
H=FCsgenstr. 33a, D-52457 Aldenhoven
Telefon: +49-2464-8851, FAX: +49-2464-905163
--------------------------------------------------------------------
Key fingerprint =3D DA10 CC82 62F8 1DBB 39A1  1EDC 725B 3317 A8D7 C3A6
Keyserver: http://www.keyserver.net/en/