[Zope-Checkins] CVS: Zope/lib/python/App - Product.py:1.63

Jens Vagelpohl jens@zope.com
Mon, 9 Jun 2003 10:22:57 -0400


Update of /cvs-repository/Zope/lib/python/App
In directory cvs.zope.org:/tmp/cvs-serv23841/lib/python/App

Modified Files:
	Product.py 
Log Message:
- consult other version.txt variations for version information for product



=== Zope/lib/python/App/Product.py 1.62 => 1.63 ===
--- Zope/lib/python/App/Product.py:1.62	Wed May 28 10:51:12 2003
+++ Zope/lib/python/App/Product.py	Mon Jun  9 10:22:57 2003
@@ -489,12 +489,22 @@
 def initializeProduct(productp, name, home, app):
     # Initialize a levered product
     products=app.Control_Panel.Products
+    fver = ''
 
     if hasattr(productp, '__import_error__'): ie=productp.__import_error__
     else: ie=None
 
-    try: fver=open(home+'/version.txt').read().strip()
-    except: fver=''
+    # Retrieve version number from any suitable version.txt
+    for fname in ('version.txt', 'VERSION.txt', 'VERSION.TXT'):
+        try:
+            fpath = os.path.join(home, fname)
+            fhandle = open(fpath, 'r')
+            fver = fhandle.read().strip()
+            fhandle.close()
+            break
+        except IOError:
+            continue
+
     old=None
     try:
         if ihasattr(products,name):