[Checkins] SVN: zope.kgs/trunk/src/zope/kgs/latest.py In case parsing the index page fails, don't fail, just report it.

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun Feb 1 23:40:38 EST 2009


Log message for revision 95951:
  In case parsing the index page fails, don't fail, just report it.
  

Changed:
  U   zope.kgs/trunk/src/zope/kgs/latest.py

-=-
Modified: zope.kgs/trunk/src/zope/kgs/latest.py
===================================================================
--- zope.kgs/trunk/src/zope/kgs/latest.py	2009-02-02 04:33:48 UTC (rev 95950)
+++ zope.kgs/trunk/src/zope/kgs/latest.py	2009-02-02 04:40:37 UTC (rev 95951)
@@ -39,7 +39,7 @@
 import urllib2
 import zope.kgs.kgs
 
-SIMPLE_BASE_URL = "http://cheeseshop.python.org/simple/"
+SIMPLE_BASE_URL = "http://pypi.python.org/simple/"
 VERSION_REGEX = '%s-(.*)(?:\.tar\.gz|\.zip)'
 
 def getAllVersions(packageName):
@@ -49,7 +49,11 @@
     page = urllib2.urlopen(SIMPLE_BASE_URL + packageName + '/').read()
     # Parse the page to find all links that could possibly contain versoin
     # information.
-    tree = lxml.etree.fromstring(page)
+    try:
+        tree = lxml.etree.fromstring(page)
+    except lxml.etree.XMLSyntaxError:
+        print packageName + ': Parsing index page failed.'
+        return []
     # Extract the versions from the links.
     regex = re.compile(VERSION_REGEX %packageName)
     versions = []



More information about the Checkins mailing list