[Zope] Can't use aq_parent in Product??

Paul Winkler slinkp23@yahoo.com
Sun, 11 Nov 2001 21:05:41 -0500


I have a Product I'm creating (python, not Zclass).  I thought that I
could get the parent object of an instance of my product using the
aq_parent method. But AFAIKT, this only works on an "acquisition
wrapper" of an object - not on the object itself??

Example: try this in  Boring product:

class BrokenBoring(
    OFS.SimpleItem.Item,   # A simple Principia object. Not Folderish. 
    Persistent,            # Make us persistent. Yaah! 
    Acquisition.Implicit,  # Be able to find things via acquisition.
    AccessControl.Role.RoleManager # Security manager. 
    ): 
    """
    Can't acquire the parent... fooey.
    """        
    meta_type = 'Boring' # what do people think they're adding? 

(snip)

    def __init__(self, id, title=''): 
        """initialise a new instance of Boring"""

(snip)
        try: assert hasattr(self, "aq_parent")
        except: print "Hey! This instance can't acquire parent!!"


When you add one of these in a folder, it prints the exception message
in the log. In other words ... no aq_parent.

So I guess I need to get an acquisition wrapper to self, so I can
acquire its parent? How do I do that? I can't figure it out from the
DevGuide.  Or Is there a less bletcherous solution?
Help!

--

paul winkler
home:  http://www.slinkp.com
music: http://www.reacharms.com
calendars: http://www.calendargalaxy.com