[Checkins] SVN: grokproject/trunk/ Check for download errors when getting the release info files from

Maurits van Rees m.van.rees at zestsoftware.nl
Thu Jul 3 05:26:11 EDT 2008


Log message for revision 87951:
  Check for download errors when getting the release info files from
  grok.zope.org.  That way we give a meaningful error message to the user.
  

Changed:
  U   grokproject/trunk/CHANGES.txt
  U   grokproject/trunk/grokproject/templates.py

-=-
Modified: grokproject/trunk/CHANGES.txt
===================================================================
--- grokproject/trunk/CHANGES.txt	2008-07-03 09:07:34 UTC (rev 87950)
+++ grokproject/trunk/CHANGES.txt	2008-07-03 09:26:11 UTC (rev 87951)
@@ -4,6 +4,10 @@
 0.8 (unreleased)
 ------------------
 
+* Check for download errors when getting the release info files from
+  grok.zope.org.  That way we give a meaningful error message to the
+  user.
+
 * Removed dependency on zc.buildout as we already use
   bootstrap.py-like code to install it on the fly if it is not there
   yet.

Modified: grokproject/trunk/grokproject/templates.py
===================================================================
--- grokproject/trunk/grokproject/templates.py	2008-07-03 09:07:34 UTC (rev 87950)
+++ grokproject/trunk/grokproject/templates.py	2008-07-03 09:26:11 UTC (rev 87951)
@@ -63,11 +63,22 @@
         vars['app_class_name'] = vars['project'].capitalize()
 
         # Handling the version.cfg file.
+        print "Downloading info about versions..."
         current_info_url = GROK_RELEASE_URL + 'current'
-        info = urllib.urlopen(current_info_url).read().strip()
+        try:
+            info = urllib.urlopen(current_info_url).read().strip()
+        except IOError:
+            print "Error: cannot download required %s" % current_info_url
+            print "Server may be down.  Please try again later."
+            sys.exit(1)
         version_info_url = urlparse.urljoin(current_info_url, info)
         vars['version_info_url'] = version_info_url
-        version_info_file_contents = urllib.urlopen(version_info_url).read()
+        try:
+            version_info_file_contents = urllib.urlopen(version_info_url).read()
+        except IOError:
+            print "Error: cannot download required %s" % version_info_url
+            print "Server may be down.  Please try again later."
+            sys.exit(1)
         vars['version_info_file_contents'] = version_info_file_contents
 
         # Which grok version are we depending on?



More information about the Checkins mailing list