[Zope-dev] Access Zope objects from python
Hi This question is from a Zope newbie, who gets a little confused when trying to write a product for Zope. My product fetches a lot of picture information, and this information shall be viewed in a fotogallery (the viewer is made as a ZPT) My question is really simple then: When I write this product in python, how could I generate a zope image object of each of the pictures in the db. The part I am interested in is how I can access and create zope objects from python. Which classes do I have to inherit from? -Tor Oskar Wilhelmsen ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Access Zope objects from python
Tor Oskar Wilhelmsen wrote: Hi This question is from a Zope newbie, who gets a little confused when trying to write a product for Zope. My product fetches a lot of picture information, and this information shall be viewed in a fotogallery (the viewer is made as a ZPT) My question is really simple then: When I write this product in python, how could I generate a zope image object of each of the pictures in the db. The part I am interested in is how I can access and create zope objects from python. Which classes do I have to inherit from? -Tor Oskar Wilhelmsen Hi, the zope developer guide (ZDG) is your friend, this chapter perhasp in particular. http://zope.org/Documentation/Books/ZDG/current/Products.stx the ZDG goes on about interfaces in it's first chapters. Yo donot need to use Interfaces if you do not want to, but they are very handy. Note that the ZDG is for 2.4, but it should work fairly OK. The ZGD is a good companion to the Zope Book when developing products. Hope this helps. /dario -- -- --- Dario Lopez-Kästen, IT Systems Services Chalmers University of Tech. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Zope 2.7.0 and Pythom Image Library
Tor Oskar Wilhelmsen wrote: I'm trying to get the PIL(last version on python 2.3) working with Zope, but it seems that it's not working. I use the code: file = StringIO.StringIO(data) im = Image.open(file) im.show() where data is datafrom a blob in a db. This code is working outside Zope, but at once when i try to make it a product in Zope, I get this error: IOError: cannot identify image file I've had problems using PIL-based products in Zope because Zope has its own module called ImageFile and Zope does some sys.path munging so that when certain PIL modules do import ImageFile, they import the Zope version, instead of the ImageFile.py that comes with PIL. This causes lots of hard-to-track errors that have weird error messages ( I always get BadFont ). I have fixed this problem before by editing the module for the type of image I am using to do a more explicit import. For example, for JPEG images, I edit PIL/JpegImagePlugin.py to read: from PIL import ImageFile This is at or around line 34, which reads import ImageFile. So, you could make the changes to the files corresponding to the Image type you are using, then *restart Zope* (the fix is in site-packages so a Refresh won't do it!) and then give it a try. I'd be happy to hear if this helps you, John Ziniti ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )