App Engine 1.1.9 update breaks django 1.0. Monkey patch django to only check for SVN revision number when not running using dev_appserver. On deployed version this doesn't apply since we use django from zipped file.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Thu, 12 Feb 2009 12:58:26 +0000
changeset 1279 f85ac8856dca
parent 1278 a7766286a7be
child 1280 9a510b94cf22
App Engine 1.1.9 update breaks django 1.0. Monkey patch django to only check for SVN revision number when not running using dev_appserver. On deployed version this doesn't apply since we use django from zipped file. This issue was discussed here: http://groups.google.com/group/codereview-discuss/browse_thread/thread/a7ab6ceb39c09ce6 http://groups.google.com/group/google-appengine/browse_thread/thread/bbdebf8617b57512 Patch by: Pawel Solyga Review by: to-be-reviewed
app/django/utils/version.py
--- a/app/django/utils/version.py	Thu Feb 12 12:30:36 2009 +0000
+++ b/app/django/utils/version.py	Thu Feb 12 12:58:26 2009 +0000
@@ -19,20 +19,21 @@
         path = django.__path__[0]
     entries_path = '%s/.svn/entries' % path
 
-    if os.path.exists(entries_path):
-        entries = open(entries_path, 'r').read()
-        # Versions >= 7 of the entries file are flat text.  The first line is
-        # the version number. The next set of digits after 'dir' is the revision.
-        if re.match('(\d+)', entries):
-            rev_match = re.search('\d+\s+dir\s+(\d+)', entries)
-            if rev_match:
-                rev = rev_match.groups()[0]
-        # Older XML versions of the file specify revision as an attribute of
-        # the first entries node.
-        else:
-            from xml.dom import minidom
-            dom = minidom.parse(entries_path)
-            rev = dom.getElementsByTagName('entry')[0].getAttribute('revision')
+    if not os.environ['SERVER_SOFTWARE'].startswith('Dev'):
+      if os.path.exists(entries_path):
+          entries = open(entries_path, 'r').read()
+          # Versions >= 7 of the entries file are flat text.  The first line is
+          # the version number. The next set of digits after 'dir' is the revision.
+          if re.match('(\d+)', entries):
+              rev_match = re.search('\d+\s+dir\s+(\d+)', entries)
+              if rev_match:
+                  rev = rev_match.groups()[0]
+          # Older XML versions of the file specify revision as an attribute of
+          # the first entries node.
+          else:
+              from xml.dom import minidom
+              dom = minidom.parse(entries_path)
+              rev = dom.getElementsByTagName('entry')[0].getAttribute('revision')
 
     if rev:
         return u'SVN-%s' % rev