automated setting of object properties?
I wonder if someone could offer advice on how to accomplish the following ... I notice that in version 2.x of Zope, uploaded images autmagically get their height and width properties set appropriately. This was not the case with version 1.x, at least for content import via the fsimport external method. I imported a slew of content with Zope 1.x and thus have a lot of images with height and width properties of 0. I would like to write an external method to scan through my entire database setting the height/width fields to their correct values. So far I haven't had any luck getting this to work. Any advice would be much appreciated. Cheers, Darran. -- Darran Edmundson [Darran.Edmundson@anu.edu.au]
Darran Edmundson wrote:
not the case with version 1.x, at least for content import via the fsimport external method. How about http://www.zope.org:18200/Members/kslee/pseudo_image. It has the source of something similiar to fsimport but imports only images and sets height & width.
I imported a slew of content with Zope 1.x and thus have a lot of images with height and width properties of 0. I would like to write an external method to scan through my entire database setting the height/width fields to their correct values. So far I haven't had any luck getting this to work. Any advice would be much appreciated. <warning> I'm writing from memory. It might not be wrong. </waring>
As far as I read from the source of Zope 2.0bx, height/width properties are set when image objects are created. Since raw() method returns the raw data and Zope source or the above mentioned link has the part that sets height/width properties, you might be able to utilize manage_changeProperties() method in your external method. However, if i were you, i'd wget & import again using fsimport(for Zope2.0 if any) or the tweaked version of the external method from the above link. LEE Kwan Soo.
Darran Edmundson wrote:
I wonder if someone could offer advice on how to accomplish the following ...
I notice that in version 2.x of Zope, uploaded images autmagically get their height and width properties set appropriately. This was not the case with version 1.x, at least for content import via the fsimport external method.
I imported a slew of content with Zope 1.x and thus have a lot of images with height and width properties of 0. I would like to write an external method to scan through my entire database setting the height/width fields to their correct values. So far I haven't had any luck getting this to work. Any advice would be much appreciated.
Cheers, Darran.
Hi Darran, maybe Ross Lazarus' external method "fileme" (http://www.zope.org/pipermail/zope/1999-June/005060.html) can give you some hints on traversing the zope tree and doing things to objects. (fileme recursively saves zope folders and their sub-objects out to the harddisk - but what you actually do to the object is not so important, I think tree traversal should be the hardest). btw: Ross would appreciate to receive an email notice if you download fileme... Hope this helps, Heiko -- Heiko Stoermer MIG Augsburg
participants (3)
-
Darran Edmundson -
Heiko Stoermer -
À̰ü¼ö