[Zope] About publishing image files in python product

Dirksen dirksen_lau@yahoo.com
Fri, 27 Apr 2001 01:15:54 -0700 (PDT)


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/