why don't you just make your class a container so you can add images with self._setObject ----- Original Message ----- From: "Dirksen" <dirksen_lau@yahoo.com> To: "zope" <zope@zope.org> Sent: Friday, April 27, 2001 10:15 AM Subject: [Zope] About publishing image files in python product
I'm writing a python product, which will publish a lot of image files as class attributes. 2 problems arose:
1. All image files have to be manually declared as class attributes in the python class file, which is a tedius job.
2. The declaration mentioned above doesn't allow dot in the attribute name (it may be my ignorance), so 'toolbar.gif' has to be renamed to 'toolbar_gif'.
I sort of found a work-around by overriding __getitem__, like this: def __getitem__(self, name): return ImageFile('img/%s' % name, globals())
It solves the problem. But after the excitement subsided, I started to wonder why DC doesn't do that in the first place. Can anyone tell whether there's a huge performance trade-off? Is there a better way to solve the two problems?
Cheers Dirksen
__________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )