[Zope] Strange error with Photo Product

Dennis Allison allison@sumeru.stanford.EDU
Sun, 14 Jul 2002 09:47:37 -0700 (PDT)


A work in progress using Zope 2.5.1 incorporates Photo 1.2.3.
The use is what one would expect.  There's a Photo Folder which 
holds Photos.  In my case, the Photo Folder was constructed 
through the ZMI.  Photographs are uploaded from the web using a 
<input type=file ...> form.  The action for the form is a python
script that creates a Photo object in the Photo Folder using the 
passed-in File Object.

The form action calls 

container.manage_addProduct.manage_addPhoto(id,title,file,.. )

which apparently executes correctly, up to a point. Here "container" is
the Photo Folder object.  The Photo object is constructed and stored in
the Photo Folder. BUT, after creating and string the Photo in the Photo
Folder, Zope raises a key error on the File Object variable.  The
traceback isn't very helpful at localizing the error.


Zope Error
Zope has encountered an error while publishing this resource.
Error Type: KeyError
Error Value: the_file

...

 File /var/zope/lib/python/Products/PythonScripts/PythonScript.py, line
302, in _exec
    (Object: photo_upload)
    (Info: ({'script': <PythonScript instance at 8b70a88>, 'context':
<Folder instance at 8d91b60>, 'container': <Folder instance at 8d91b60>,
'traverse_subpath': []}, (), {}, None))
  File Script (Python), line 8, in photo_upload
  File /var/zope/lib/python/AccessControl/ZopeGuards.py, line 90, in
guarded_getitem
  File /var/zope/lib/python/ZPublisher/HTTPRequest.py, line 847, in
__getitem__
KeyError: (see above) File


Protections for the Photo Folder allow anyone to Add or change Photos (at 
the moment).

So, I'm at a loss to know where and how this happens.  The logic of the
Photo Product defers the actual insertion, but it appears to function by 
value (that is, the data is saved, not the object that contains it).

Help much appreciated.