aboutsummaryrefslogtreecommitdiffstats
path: root/src/pyexiv2.py
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-02-04 08:22:36 +0100
committerOlivier Tilloy <olivier@tilloy.net>2009-02-04 08:22:36 +0100
commit2b3f22c1710a96de655af3cb98a8191baeb802be (patch)
tree875389009aa4d41c6d521f4e0666bf36629bf052 /src/pyexiv2.py
parent9f315477dacd0df820a6912e7218f63e7601ccec (diff)
downloadpyexiv2-2b3f22c1710a96de655af3cb98a8191baeb802be.tar.gz
Fixed an invalid Date conversion.
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r--src/pyexiv2.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py
index 8fa4a48..1b54782 100644
--- a/src/pyexiv2.py
+++ b/src/pyexiv2.py
@@ -483,7 +483,7 @@ class XmpTag(MetadataTag):
# strptime is not flexible enough to handle all valid Date formats, we use a
# custom regular expression
_time_zone_re = r'Z|((?P<sign>\+|-)(?P<ohours>\d{2}):(?P<ominutes>\d{2}))'
- _time_re = r'(?P<hours>\d{2}):(?P<minutes>\d{2})(:(?P<seconds>\d{2})(.(?P<decimal>\d+))?)?(?P<tzd>%s)' % _time_zone_re
+ _time_re = r'(?P<hours>\d{2})(:(?P<minutes>\d{2})(:(?P<seconds>\d{2})(.(?P<decimal>\d+))?)?(?P<tzd>%s))?' % _time_zone_re
_date_re = re.compile(r'(?P<year>\d{4})(-(?P<month>\d{2})(-(?P<day>\d{2})(T(?P<time>%s))?)?)?' % _time_re)
def __init__(self, key, name, label, description, type, values):
@@ -547,6 +547,9 @@ class XmpTag(MetadataTag):
except ValueError:
raise XmpValueError(value, xtype)
else:
+ if gd['minutes'] is None:
+ # Malformed time
+ raise XmpValueError(value, xtype)
if gd['seconds'] is not None:
seconds = int(gd['seconds'])
else: