Hi,
Apparently my knowledge of Zope/Python is still to limited.
I have a product that derives from Folder. When I add this product to a
folder via zmi I want to have it populated with other products to it
programmatically. I tried to do so in the __init__ function. That works with
objects like acl_user folders, but not with products in the products
directory. Can anyone send me in the right direction or at least give a hint
where to look for a solution?

With trial and error I came thus far (stripped down to the basics):

Module QuerySet.py:
from Query import manage_addQuery
class QuerySet(Folder):
    def __init__(self, id, title):
        self.id = id
        self.title = title
        self.manage_addUserFolder()
        manage_addQuery(self, id, title)

manage_addQuery in Query.py looks like:
def manage_addQuery(dispatcher, id, title, REQUEST=None):
    "...."
    nQ=Query(id,title)
    dispatcher.Destination()._setObject(id, nQ)
    if REQUEST is not None:
        dispatcher.manage_main(dispatcher, REQUEST)

Traceback (innermost last):
  Module ZPublisher.Publish, line 101, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 39, in call_object
  Module Products.QuerySet.QuerySet, line 80, in manage_addQuerySet
  Module Products.QuerySet.QuerySet, line 107, in __init__
  Module Products.Query.Query, line 80, in manage_addQuery
AttributeError: Destination

zope 2.7.8, win32

tia, cb


_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to