diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2007-03-30 22:38:08 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2007-03-30 22:38:08 +0200 |
commit | 5b9561b2f53982f76990ce63d5f44271ebc3923e (patch) | |
tree | ee3e4d7cd6d1f0f3dfcc3c74ee510afd200885ab /src/pyexiv2.py | |
parent | 59de8016bf0ccd69f7eb4059b052acead79eb3f2 (diff) | |
download | pyexiv2-5b9561b2f53982f76990ce63d5f44271ebc3923e.tar.gz |
Changed the type of exception raised when trying to get a value corresponding to an invalid key (TypeError, to comply with http://docs.python.org/ref/sequence-types.html).
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r-- | src/pyexiv2.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 02af79e..118b899 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -455,7 +455,6 @@ class Image(libpyexiv2.Image): self.__setIptcTag(key, strVal, index) def __getitem__(self, key): - #print 'Calling __getitem__(...)' if key.__class__ is not str: raise TypeError('Key must be of type string') tagFamily = key[:4] @@ -478,10 +477,12 @@ class Image(libpyexiv2.Image): self.__iptcTagsDict[key] = value return value else: - raise IndexError("'" + key + "': invalid tag identifier") + # This is exiv2's standard error message, all futures changes on + # exiv2's side should be reflected here. + # As a future development, consider i18n for error messages. + raise IndexError("Invalid key `" + key + "'") def __setitem__(self, key, value): - #print 'Calling __setitem__(...)' if key.__class__ is not str: raise TypeError('Key must be of type string') tagFamily = key[:4] @@ -538,7 +539,7 @@ class Image(libpyexiv2.Image): else: del self.__iptcTagsDict[key] else: - raise IndexError("'" + key + "': invalid tag identifier") + raise IndexError("Invalid key `" + key + "'") def __delitem__(self, key): #print 'Calling __delitem__(...)' @@ -557,7 +558,7 @@ class Image(libpyexiv2.Image): self.__deleteIptcTag(key, 0) del self.__iptcTagsDict[key] else: - raise IndexError("'" + key + "': invalid tag identifier") + raise IndexError("Invalid key `" + key + "'") def cacheAllExifTags(self): for key in self.exifKeys(): |