preventing add list pollution - how?
I knew the best practice to do that, but I forgot it, and don't find the solution on zope or elsewhere, and probably I'm confused. Say I have a container product, and objects which just will be added to that container or its subobjects. Therefore I don't want the subobjects to appear in the general add list, just in the add list of the container. I know how to manipulate that add-lists, my problem is what to do with the subobjects to get them into zope "properly". Do I write my subobjects like normal zope product, just without registering them with zope as products? Do I then add instance of my subobjects to a container just using _.setObject? cheers, oliver
Oliver Bleutgen wrote:
Do I write my subobjects like normal zope product, just without registering them with zope as products? Do I then add instance of my subobjects to a container just using _.setObject?
That sounds like a good solution :-) There are others, but they're not well documented and involve some voodoo... Hint: Look at the PluginIndexes product... cheers, Chris
Chris Withers wrote:
Oliver Bleutgen wrote:
Do I write my subobjects like normal zope product, just without registering them with zope as products? Do I then add instance of my subobjects to a container just using _.setObject?
That sounds like a good solution :-)
There are others, but they're not well documented and involve some voodoo...
Hint: Look at the PluginIndexes product...
Dang, is this a quiz show? ;-> I have to ask, you mean just putting setting "visibility = None" when registering the product? This does it? Whoa. So I can just put in a visibility = "olivers_cool_product" and test for that in my product to make it visible there? Cool. Why didn't someone tell me about that, I had upgraded to a zope > 2.3.3 long before alone for that feature. thanks, oliver
Oliver Bleutgen writes:
I knew the best practice to do that, but I forgot it, and don't find the solution on zope or elsewhere, and probably I'm confused.
Say I have a container product, and objects which just will be added to that container or its subobjects. Therefore I don't want the subobjects to appear in the general add list, just in the add list of the container. I know how to manipulate that add-lists, my problem is what to do with the subobjects to get them into zope "properly".
Do I write my subobjects like normal zope product, just without registering them with zope as products? Do I then add instance of my subobjects to a container just using _.setObject? I do it like this (for a CMF site):
class ContainerProduct(...): ... def all_meta_types(self): '''return list of allowed meta types.''' return ( { 'name' : PortalConfig.meta_type, 'action': 'PortalConfig_add', # that's a skin form, calling "addPortalConfig" 'permission': ManagePortal, }, ) def addPortalConfig(self,id,title='',RESPONSE=None): '''add Portal Config object.''' o= PortalConfig(); o.id= id; o.title= title self._setObject(id,o) if RESPONSE is not None: RESPONSE.redirect('%s/manage_main' % self.absolute_url()) class PortalConfig(...): ... Dieter
participants (3)
-
Chris Withers -
Dieter Maurer -
Oliver Bleutgen