[Zope] About publishing image files in python product
Dieter Maurer
dieter@handshake.de
Fri, 27 Apr 2001 20:14:53 +0200 (CEST)
Dirksen writes:
> 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.
You can do that programmatically:
class C...:
...
for image in (<your list of image names; of cause you need to name them>):
setattr(C,image,ImageFile('img/%s' % image, globals()))
This will get rid of your second problem, too: dot's in names.
Dieter