At 06:10 PM 11/8/00 +0200, Roch'e Compaan wrote:
In Rack.py I noticed the following:
a = self.loadAttrib if not a: slot = self._writeableSlot(key) slot[SelfKey] = item.aq_base # strip acquisition wrapping item._setSlot(slot) # Not needed for non-ZODB storage
If item._setSlot set is not needed for non-ZODB storage should I subclass rack and override createItem?
I'm not sure I understand your question. If you don't have something special you want to do by subclassing Rack, then the answer would be "no". :) The comment is perhaps misleading. What it means is that the _setSlot call isn't needed if your Rack implements a non-ZODB storage mechanism. The reason *why* it isn't needed, is that the DataSkin will ask for a slot on demand, so that a ZODB record is only created if something needs to be stored persistently. However, in the case where you have not set a "load" attribute (i.e., you are storing actual objects in the ZODB), then one might as well tell the object its slot, because the slot is where the object itself is going to be stored. Technically, the _setSlot call isn't necessary even then, because the DataSkin could still ask for it on demand. However, since the code at this point has gone to the trouble of getting the slot object, it might as well pass it to the DataSkin immediately.