25 Nov
2002
25 Nov
'02
11:59 p.m.
On Mon, Nov 25, 2002 at 08:46:47PM +0100, maxm wrote:
I have a gif image that I would like to return via a __getattr__ method.
But I have no clues as to how I can do it.
img_data # binary image data
# The problem below is that it needs a docstring to get published.
def __getattr__(self, attr): if attr = 'gif_image': return img_data
Note that __getattr__ is already heavily used by the zope machinery. It is not easy or fun to define on your own classes. Depending on what you want to achieve, try __getitem__ or __bobo_traverse__ instead. --PW -- Paul Winkler http://www.slinkp.com "Welcome to Muppet Labs, where the future is made - today!"