[Zope-dev] ZPatterns bug: infinite recursion with External Attribute Provider

Phillip J. Eby pje@telecommunity.com
Tue, 19 Sep 2000 10:30:10 -0500


At 09:18 PM 9/17/00 +0100, Steve Alexander wrote:
>
>I can fix this, by patching DataManager to use client.__dict__ instead:
>
>    def _readableSlotFor(self,client):
>        #slot = getattr(client,'__skinSlot__',_marker)
>        slot = client.__dict__.get('__skinSlot__',_marker)
>        
>        if slot is _marker: return {}
>
>        client._setSlot(slot); return slot
>
>    def _writeableSlotFor(self,client):
>        #slot = getattr(client,'__skinSlot__',_marker)
>        slot = client.__dict__.get('__skinSlot__',_marker)
>
>        if slot is _marker:
>            #slot = client.__skinSlot__ = PersistentMapping()
>            slot = client.__dict__['__skinSlot__'] = PersistentMapping()

You also need "client._p_changed = 1" here, or the slot will not be saved.


>This works, in as far as I can do things like add sub-objects to a
>ZClass that derives from DataSkin and ObjectManager without infinite
>regress. However, I still get an attribute error. This is because the
>External Attribute Provider only offers to set and delete its
>attributes. I'm confused as to why this should be -- surely the External
>Attribute Provider should offer to get the same attributes as it is
>offering to set and delete?

That was me forgetting to update the namesForRegistration method in the
subclass.  :(


>I can now add sub-objects to my ZClass instances, and I can traverse to
>those sub-objects by typing them into the URL field of my browser.
>However, I can't get a list of the sub-objects by calling objectIds.

Hm.  I don't know what could cause that, if the other bugs are fixed.  I'm
in the process of getting all the patches checked in right now to do a
release today (I hope).