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
Ok, I plucked up courage and tried what I thought would help, and it did.
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)
[...] ---------------------------------------------------------------------
if you change
if not hasattr(self, id):
to
if not hasattr(self.aq_explicit, id):
everything works as "expected". At second thought... in some other environment I might have just killed a feature! Maybe put some flag "aquired stuff counts" here to have both? Danny
participants (1)
-
Danny William Adair