#5 class Image.getattr incorrect

open
Martin Blais
None
5
2002-04-20
2001-11-04
Thomas Hammer
No

The method getattr in the class Image is supposed to
return the tag content from the image attribute file.
If the tag is not found, the directory attribute file
is to be used as a fallback. Only if also not found
there, "None" is returned.

The current implementation does not consult the
directory attribute file.

Here the patch which works for me, the original code
is commented:

def getattr( self, tag ):

"""Returns an attribute from the attribute files
for this image. This
method looks up the tag from both the
image-specific attributes file and
the directory attributes file."""

"""if self._attr:
return self._attr.get( tag )
elif not tag and self._dirattr:
return self._dirattr.get( tag )
else:
return None"""
if self._attr:
i = self._attr.get( tag )
if i: return i
if self._dirattr:
d = self._dirattr.get( tag )
if d: return d
return None

Discussion

  • Martin Blais
    Martin Blais
    2002-04-20

    • assigned_to: nobody --> blais
     
  • Martin Blais
    Martin Blais
    2003-01-07

    Logged In: YES
    user_id=10996

    will look at it before 2.0