I'm trying to upload a Photo into a newly create object in my product class. The code looks something like this::

def manage_addSomething(dispatcher, id, title, photofile):
    destination = dispatcher.Destination()
    instance = Something(id, title)
    destination._setObject(id, instance)
    obj = destination._getOb(id)
    # at this point, is 'obj' wrapped in aq stuff???

    _adder = obj.manage_addProduct['Photo'].manage_addPhoto
    _adder(id='', title='', file=photofile)

class Something(Folder):
    def __init__(self, id, title):
        self.id = id
        self.title = title

The error I get is:
File "/home/peterbe/zope/zope285/Products/Photo/Photo.py", line 664, in manage_addPhoto
    dest._setObject(id, photo)
AttributeError: _setObject

I'm using Photo product 1.2.3 but I don't think it matters if it's a Photo I'm trying to add or any other product.

If I add the photo after the transaction has been completed in a separate request it works fine to add the photo to the recently created object.

Any idea?

Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
Zope maillist  -  Zope@zope.org
**   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