[Zope] Creating Photo object from an Image object

Thomas Adams thomas.adams at onlinehome.de
Sat Jul 16 14:25:15 EDT 2005


Hi,

I have a problem with the "Photo" product. I want to create a Photo 
object from an existing Image object.
I have a form with id and title input tags which are initialized with 
appropriate values from a special folder where
the Image objects resides
.
Now I have written a PythonSript to handle the creation of a new Photo 
object
#id1,title1  image id and  tile
def doAddPhoto(id1, title1):
    # some comments
    ....
   
    img = context.getObjectById(id1) # this returns the object part of 
object item array from context.objectItems
    s="ph" +str(id1)   
    context.manage_addPhoto(id=s, file=img.data,title=title1, 
displays=None, precondition='', content_type='image/jpeg') (line 12)


If I submit the form, an error occurs:

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 Shared.DC.Scripts.Bindings, line 306, in __call__
  Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 323, in _exec
  Module None, line 12, in doAddPhoto
   - <PythonScript at /www.ecommerce.de/doAddPhoto>
   - Line 12
AttributeError: manage_addPhoto


When I try it with context.manage_addImage everything works fine.

I can't figure out why the above Exception is thrown, the source code
of Photo's manage_addPhoto function looks as similar as the
manage_addImage function of the Image class (from which Photo is derived)
and i have no clue where the pitfall is.

Does anybody have an idea or a hint?

Help would be appreciate.

Thanks in advance

Thomas Adams




-------------- next part --------------
A non-text attachment was scrubbed...
Name: thomas.adams.vcf
Type: text/x-vcard
Size: 239 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20050716/b5fc33f9/thomas.adams.vcf


More information about the Zope mailing list