[Zope] How to convert an Image to an Photo programmatically ?
Joachim Schmitz
js@aixtraware.de
Thu, 21 Mar 2002 15:54:57 +0100
Hi,
I have a bunch of images in the ZODB, which I want to convert to Photos in=20
the Photo product.
The following script:
request =3D context.REQUEST
# Upgrade Photos
for photo in context.objectItems(['Image']):
# Convert old photo object to new.
print photo
photoid =3D photo[0]
photo =3D photo[1]
if photo.data:
id =3D context.Photos.manage_addProduct['Photo'].manage_addPhoto(
photoid, photo.title, photo.data,
store=3D'Image', engine=3D'PIL', REQUEST=3Drequest)
##newphoto =3D getattr(context, id)
results in:
Error Type: AttributeError
Error Value: read
.....
File=20
/usr/local/ZopePark/tozo2.aixtraware.de/ZInstanceHome/Products/Photo/Photo.
py, line 654, in manage_addPhoto
Mit freundlichen Gr=FC=DFen Joachim Schmitz
--------------------------------------------------------------------
AixtraWare Ingenieurb=FCro f=FCr Internetanwendungen
H=FCsgenstr. 33a, D-52457 Aldenhoven
Telefon: +49-2464-8851, FAX: +49-2464-905163
--------------------------------------------------------------------
Key fingerprint =3D DA10 CC82 62F8 1DBB 39A1 1EDC 725B 3317 A8D7 C3A6
Keyserver: http://germany.keyserver.net/en/