[Zope] UserInfoFolder - bug? I think yes

Danny William Adair Danny@Adair.net
Thu, 5 Apr 2001 15:08:23 +1200


I installed UserInfoFolder and instantiated it in the following structure:


mySite ------- test (DTML document)
          -
          ---- protected (Folder) ------- acl_users (User Folder)
                                     -
                                     ---- guestbooks (UserInfoFolder)


Upon creation, I told the UserInfoFolder "guestbooks" to hold a Class "Gb"
of the Product "SimpleGb".
As soon as I add a user "test" to the user folder, "guestbooks" will not
hold a new "Gb" instance named "test", but all of a sudden hold - or
"show" - (a copy of) my DTML document "test", from the folder above. (same
problems with other ZClasses than "Gb")

So I took a look at UserInfoFolder.py...

UserInfoFolder.py:
---------------------------------------------------------------------
class UserInfoFolder(ObjectManager,PropertyManager,Item,RoleManager):

    [...]

    def _getOb(self, id, default=''):
        if not hasattr(self, id):
            product=self.manage_addProduct[self.productName]
            zclass=eval('product.'+self.className)
            obj=apply(zclass,[])
            obj._setId(id)
            self._setObject(id,obj,set_owner=0)
            return obj
        return getattr(self, id)

    [...]
---------------------------------------------------------------------

I translate the main part to:
"As soon as someone accesses an object with the id 'id' within you, look if
you 'have it'. If yes, return that object, if no, add an instance of the
specified class."

Well, hasattr() is true, even if some object with the id 'id' has been
_aquired_, right? Just has to be in the namespace, right? Is it correct that
there is something like 'aq_explicit' missing here? And where? I think this
is an easy one, but I'm afraid to break something, mommy...

thank you in advance,

Danny