[Zope-Checkins] CVS: Zope - z2.py:1.78.2.1

Jim Fulton jim@zope.com
Wed, 17 Jul 2002 17:15:34 -0400


Update of /cvs-repository/Zope
In directory cvs.zope.org:/tmp/cvs-serv7961

Modified Files:
      Tag: Zope-2_7-development-branch
	z2.py 
Log Message:
Changed the Zope package to be a pure (well almost pure) container
package, in preparation for making some Zope 3 packages available in
Zope 2.7.

Now importing Zope has no side effects (other than adding an entry to
sys.modules). 

To initialize the Zope application server, you need to call the
startup function in the Zope package:

  import Zope    # does nothing
  Zope.startup() # initializes the application

Zope.startup populates the Zope package with the traditional
attributes, like DB and debug.

Note that calling startup additional times has no effect.



=== Zope/z2.py 1.78 => 1.78.2.1 ===
     python_version = sys.version.split()[0]
     if python_version < '2.1':
         raise 'Invalid python version', python_version
-    if python_version[:3] == '2.1':
-        if python_version[4:5] < '3':
+    if float(python_version[:3]) < 2.2:
             import warnings
-            err = ('You are running Python version %s.  This Python version '
-                   'has known bugs that may cause Zope to run improperly. '
-                   'Consider upgrading to a Python in the 2.1 series '
-                   'with at least version number 2.1.3.  (Note that Zope does '
-                   'not yet run under any Python 2.2 version).' %
+            err = ('You are running Python version %s. This Python version '
+                   'is not supported for this version of Zope.' %
                    python_version)
             warnings.warn(err)
-    if python_version[:3] == '2.2':
-            import warnings
-            err = ('You are running Python version %s.  This Python version '
-                   'has not yet been tested with Zope and you may experience '
-                   'operational problems as a result.  Consider using '
-                   'Python 2.1.3 instead.' % python_version)
-            warnings.warn(err)
 
 
     opts, args = getopt.getopt(sys.argv[1:],
@@ -452,7 +441,6 @@
         elif o=='-h':
             print __doc__ % vars()
             sys.exit(0)
-        elif o=='-2': MODULE='Main'
         elif o=='-l': LOG_FILE=v
         elif o=='-L':
             if v: LOCALE_ID=v
@@ -564,7 +552,10 @@
         sys.__detailedlog=DL
 
     # Import Zope (or Main)
-    exec "import "+MODULE in {}
+    if MODULE == "Zope":
+        import Zope; Zope.startup()
+    else:
+        exec "import "+MODULE in {}
 
     # Location of the ZServer log file. This file logs all ZServer activity.
     # You may wish to create different logs for different servers. See