diff -ruN rssvalidator/src/feedvalidator/channel.py rssvalidator.improved/src/feedvalidator/channel.py --- rssvalidator/src/feedvalidator/channel.py 2003-12-11 11:32:08.000000000 +0000 +++ rssvalidator.improved/src/feedvalidator/channel.py 2004-01-28 03:33:36.000000000 +0000 @@ -125,7 +125,7 @@ def do_dcterms_modified(self): if "lastBuildDate" in self.children: self.log(DuplicateSemantics({"core":"lastBuildDate", "ext":"dcterms:modified"})) - return iso8601(), noduplicates() + return iso8601_strict(), noduplicates() def do_dc_publisher(self): if "webMaster" in self.children: @@ -146,7 +146,7 @@ def do_dc_date(self): if "pubDate" in self.children: self.log(DuplicateSemantics({"core":"pubDate", "ext":"dc:date"})) - return iso8601(), noduplicates() + return iso8601_strict(), noduplicates() def do_admin_generatorAgent(self): if "generator" in self.children: @@ -199,7 +199,7 @@ return sy_updateFrequency(), noduplicates() def do_sy_updateBase(self): - return iso8601(), noduplicates() + return iso8601_strict(), noduplicates() class blink(validatorBase): def validate(self): diff -ruN rssvalidator/src/feedvalidator/validators.py rssvalidator.improved/src/feedvalidator/validators.py --- rssvalidator/src/feedvalidator/validators.py 2003-12-12 15:37:06.000000000 +0000 +++ rssvalidator.improved/src/feedvalidator/validators.py 2004-01-28 03:36:18.000000000 +0000 @@ -136,7 +136,7 @@ # iso8601 dateTime # class iso8601(text): - iso8601_re = re.compile("\d\d\d\d(-\d\d(-\d\d(T\d\d:\d\d(:\d\d(\.\d*)?)?" + + iso8601_re = re.compile("^\d\d\d\d(-\d\d(-\d\d(T\d\d:\d\d(:\d\d(\.\d*)?)?" + "(Z|([+-]\d\d:\d\d))?)?)?)?$") def validate(self): if not self.iso8601_re.match(self.value): @@ -184,6 +184,21 @@ elif not 'Z' in self.value: self.log(W3DTFDateNonUTC({"parent":self.parent.name, "element":self.name, "value":self.value})) +class iso8601_strict(iso8601): + # The same as in iso8601, except a timezone is not optional when + # a time is present + iso8601_re = re.compile("^\d\d\d\d(-\d\d(-\d\d(T\d\d:\d\d(:\d\d(\.\d*)?)?" + + "(Z|([+-]\d\d:\d\d)))?)?)?$") + + def validate(self): + if not self.iso8601_re.search(self.value): + self.log(InvalidW3DTFDate({"parent":self.parent.name, "element":self.name + , "value":self.value})) + return + + iso8601.validate(self) + return 1 + class iso8601_l(iso8601): def validate(self): if iso8601.validate(self): diff -ruN rssvalidator/testcases/rss/must/dc_date_must_include_timezone.xml rssvalidator.improved/testcases/rss/must/dc_date_must_include_timezone.xml --- rssvalidator/testcases/rss/must/dc_date_must_include_timezone.xml 1970-01-01 01:00:00.000000000 +0100 +++ rssvalidator.improved/testcases/rss/must/dc_date_must_include_timezone.xml 2003-09-27 22:56:52.000000000 +0100 @@ -0,0 +1,13 @@ + + + + +Validity test +http://purl.org/rss/2.0/ +A dc:date with a time must include a timezone +2003-09-24T11:36:36 + + diff -ruN rssvalidator/testcases/rss/must/dc_date_with_just_day.xml rssvalidator.improved/testcases/rss/must/dc_date_with_just_day.xml --- rssvalidator/testcases/rss/must/dc_date_with_just_day.xml 1970-01-01 01:00:00.000000000 +0100 +++ rssvalidator.improved/testcases/rss/must/dc_date_with_just_day.xml 2003-09-27 22:53:29.000000000 +0100 @@ -0,0 +1,13 @@ + + + + +Validity test +http://purl.org/rss/2.0/ +A dc:date with just a day is valid +2003-09-24 + +