[Zope] Adding Photo programmatically
Nicholas Piper
pcomm@inorbit.com
Sun, 30 Jan 2000 16:29:28 +0000
Has anyone been able to add a Photo object in code ? DTML or Python
would be fine; At the moment I can't seem to do it at all :-(
I've followed the HOWTO about this, but it still fails.
Apparently this should work ;
def addAPhoto(self, id, REQUEST=None):
""" """
# Get the actual destination object, using the this()
# method, to be sure we get it in the right context..
self=self.this()
# Create the new instance
newob=self.Control_Panel.Products.Photo.Photo(id,'title','')
newob.id=id
# Set properties based on the contents of the Add form
newob.propertysheets.Basic.manage_changeProperties(REQUEST)
# Add a new Folder to the new instance
#self.manage_addFolder('foobar')
# Add the new instance to the target object
self._setObject(id, newob)
return 'OK!'
But it just returns ;
File /home/nicholas/downloads/Zope-2.1.1-src/Extensions/DOOO.py, line 21, in addAPhoto
(Object: ElementWithAttributes)
AttributeError: __call__
Line 21 is newob=self.Control_Panel.Products.Photo.Photo(id,'title','')
I've been calling it with http://localhost:8080/Intranet/addAPhoto?id=blue
--
<pcomm@inorbit.com> <http://www.innotts.co.uk/~nicholas/>
2048/BEC44395 1999/08/02 Nicholas C. Piper <nicholas@innotts.co.uk>
If you want to change the automatic PGP actions of my mailer, see;
http://www.innotts.co.uk/~nicholas/Personal/personal.php3?page=pgp