I have the following setup (unrelated lines are omitted):

class Deliverer(Folder):
    def manage_afterAdd(self, item, container):
        if item is self:
            self.__ac_local_roles__ = dr_localroles(self)

class dr_localroles(Persistent):
    def __init__(self, dr):
        self.dr = dr

dr_localroles implements a few methods of the dictionary interface, so I
can always check the effective settings via the Security/local roles zmi
page. In order to computing roles, dr_localroles requires its parent
object instance (Deliverer), that's why I store a reference to it as an
 - Is there a way for dr_localroles to refer its parent without holding
a reference to it or using weak reference?
 - Is there an equivalent of sys.getrefcount for ZODB persistent

Also a note for the archives:
I wanted to make sure that if I delete a Deliverer object, it will
indeed be removed from ZODB. For this I got the oid of the object,
deleted it and than tried to get it back via the oid. The trick is, that
you'll only get a POSKeyError if you pack the database and flush the
cache. This latter one was not obvious for me.


Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to