Index: src/demo.py =================================================================== RCS file: /cvsroot/feedvalidator/feedvalidator/src/demo.py,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 demo.py --- src/demo.py 3 Feb 2004 17:33:14 -0000 1.1.1.1 +++ src/demo.py 6 Feb 2004 04:58:07 -0000 @@ -13,8 +13,11 @@ # arg 1 is URL to validate link = sys.argv[1:] and sys.argv[1] or 'http://www.intertwingly.net/blog/index.rss2' print 'Validating %s' % link - - events = feedvalidator.validateURL(link, firstOccurrenceOnly=1)['loggedEvents'] + + try: + events = feedvalidator.validateURL(link, firstOccurrenceOnly=1)['loggedEvents'] + except feedvalidator.Http404: + events = [feedvalidator.Http404({})] # (optional) arg 2 is compatibility level # "A" is most basic level Index: src/feedvalidator/__init__.py =================================================================== RCS file: /cvsroot/feedvalidator/feedvalidator/src/feedvalidator/__init__.py,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 __init__.py --- src/feedvalidator/__init__.py 3 Feb 2004 17:33:14 -0000 1.1.1.1 +++ src/feedvalidator/__init__.py 6 Feb 2004 04:58:07 -0000 @@ -20,6 +20,8 @@ def __init__(self, *args): self.version = "FeedValidator/1.21 +http://feeds.archive.org/validator/" urllib.FancyURLopener.__init__(self, *args) + def http_error_404(self, url, fp, errcode, errmsg, headers, data=None): + raise Http404, 'Http404' def _validate(aString, firstOccurrenceOnly=0): """validate RSS from string, returns validator object""" @@ -66,6 +68,7 @@ def validateURL(url, firstOccurrenceOnly=1, wantRawData=0): """validate RSS from URL, returns events list, or (events, rawdata) tuple""" usock = ValidatorURLopener().open(url) + rawdata = usock.read(MAXDATALENGTH) rawdata = rawdata.replace('\r\n', '\n').replace('\r', '\n') # normalize EOL usock.close() Index: src/feedvalidator/logging.py =================================================================== RCS file: /cvsroot/feedvalidator/feedvalidator/src/feedvalidator/logging.py,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 logging.py --- src/feedvalidator/logging.py 3 Feb 2004 17:33:16 -0000 1.1.1.1 +++ src/feedvalidator/logging.py 6 Feb 2004 04:58:07 -0000 @@ -86,6 +86,8 @@ class AtomLinkMissingRel(Error): pass class MissingAlternateLink(Error): pass +class Http404(Error): pass + ###################### warning ###################### class DuplicateSemantics(Warning): pass Index: src/feedvalidator/i18n/en.py =================================================================== RCS file: /cvsroot/feedvalidator/feedvalidator/src/feedvalidator/i18n/en.py,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 en.py --- src/feedvalidator/i18n/en.py 3 Feb 2004 17:33:17 -0000 1.1.1.1 +++ src/feedvalidator/i18n/en.py 6 Feb 2004 04:58:08 -0000 @@ -84,7 +84,8 @@ MissingHref: "%(element)s must have an href attribute", AtomLinkNotEmpty: "%(element)s should not have text (all data is in attributes)", AtomLinkMissingRel: "%(element)s must have a rel attribute", - MissingAlternateLink: '''%(parent)s must contain a link element with rel="alternate"''' + MissingAlternateLink: '''%(parent)s must contain a link element with rel="alternate"''', + Http404: "Server returned 404 Not Found" }