[Zope-Checkins] SVN: Zope/branches/jim-move-Zope/lib/python/Zope
Adjusted the modules in the Zope 2 package to import from Zope2.
Jim Fulton
jim at zope.com
Sat Jan 29 16:44:39 EST 2005
Log message for revision 28976:
Adjusted the modules in the Zope 2 package to import from Zope2.
Added a Zope facade module that redirects to Zope 2. Tests pass.
Zope starts. :)
Changed:
A Zope/branches/jim-move-Zope/lib/python/Zope.py
U Zope/branches/jim-move-Zope/lib/python/Zope2/App/startup.py
U Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/__init__.py
U Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/run.py
U Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/__init__.py
U Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/testStarter.py
U Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/test_schema.py
U Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/test_warnfilter.py
U Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/zopectl.py
U Zope/branches/jim-move-Zope/lib/python/Zope2/__init__.py
-=-
Added: Zope/branches/jim-move-Zope/lib/python/Zope.py
===================================================================
--- Zope/branches/jim-move-Zope/lib/python/Zope.py 2005-01-29 21:24:35 UTC (rev 28975)
+++ Zope/branches/jim-move-Zope/lib/python/Zope.py 2005-01-29 21:44:39 UTC (rev 28976)
@@ -0,0 +1,20 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Legacy Zope "package" that redirects to the new Zope 2 package
+
+$Id$
+"""
+
+import sys, Zope2
+sys.modules['Zope'] = Zope2
Property changes on: Zope/branches/jim-move-Zope/lib/python/Zope.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: Zope/branches/jim-move-Zope/lib/python/Zope2/App/startup.py
===================================================================
--- Zope/branches/jim-move-Zope/lib/python/Zope2/App/startup.py 2005-01-29 21:24:35 UTC (rev 28975)
+++ Zope/branches/jim-move-Zope/lib/python/Zope2/App/startup.py 2005-01-29 21:44:39 UTC (rev 28976)
@@ -10,7 +10,7 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
-"""Initialize the Zope Package and provide a published module
+"""Initialize the Zope2 Package and provide a published module
"""
from AccessControl.SecurityManagement import getSecurityManager
@@ -33,7 +33,7 @@
import sys
import ZODB
import ZODB.ZApplication
-import Zope
+import Zope2
import ZPublisher
@@ -58,7 +58,7 @@
DB = configuration.dbtab.getDatabase('/', is_root=1)
Globals.BobobaseName = DB.getName()
else:
- m=imp.load_module('Zope.custom_zodb', m[0], m[1], m[2])
+ m=imp.load_module('Zope2.custom_zodb', m[0], m[1], m[2])
if hasattr(m,'DB'):
DB=m.DB
else:
@@ -66,14 +66,14 @@
DB = ZODB.DB(storage)
Globals.BobobaseName = DB.getName()
- sys.modules['Zope.custom_zodb']=m
+ sys.modules['Zope2.custom_zodb']=m
if DB.getActivityMonitor() is None:
from ZODB.ActivityMonitor import ActivityMonitor
DB.setActivityMonitor(ActivityMonitor())
Globals.DB = DB # Ick, this is temporary until we come up with some registry
- Zope.DB = DB
+ Zope2.DB = DB
# Hook for providing multiple transaction object manager undo support:
Globals.UndoManager=DB
@@ -90,7 +90,7 @@
app = ZODB.ZApplication.ZApplicationWrapper(
DB, 'Application', OFS.Application.Application, (),
Globals.VersionNameName)
- Zope.bobo_application = app
+ Zope2.bobo_application = app
# Initialize the app object
application = app()
@@ -104,17 +104,13 @@
# "Log off" as system user
noSecurityManager()
- # This is really ugly. Please remember to remove Main.py before
- # Zope 2.7 and fix whatever breaks, if anything.
- sys.modules['Main'] = sys.modules['Zope']
-
global startup_time
startup_time = log_time()
- Zope.zpublisher_transactions_manager = TransactionsManager()
- Zope.zpublisher_exception_hook = zpublisher_exception_hook
- Zope.zpublisher_validated_hook = validated_hook
- Zope.__bobo_before__ = noSecurityManager
+ Zope2.zpublisher_transactions_manager = TransactionsManager()
+ Zope2.zpublisher_exception_hook = zpublisher_exception_hook
+ Zope2.zpublisher_validated_hook = validated_hook
+ Zope2.__bobo_before__ = noSecurityManager
def validated_hook(request, user):
@@ -129,7 +125,7 @@
expires="Mon, 25-Jan-1999 23:59:59 GMT",
path=(request['BASEPATH1'] or '/'),
)
- Zope.DB.removeVersionPool(version)
+ Zope2.DB.removeVersionPool(version)
raise Unauthorized, "You don't have permission to enter versions."
Modified: Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/__init__.py
===================================================================
--- Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/__init__.py 2005-01-29 21:24:35 UTC (rev 28975)
+++ Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/__init__.py 2005-01-29 21:44:39 UTC (rev 28976)
@@ -252,8 +252,8 @@
def startZope(self):
# Import Zope
- import Zope
- Zope.startup()
+ import Zope2
+ Zope2.startup()
def makeLockFile(self):
if not self.cfg.zserver_read_only_mode:
@@ -268,7 +268,7 @@
# if we can't lock it.
# we need a separate lock file because on win32, locks are not
# advisory, otherwise we would just use the pid file
- from Zope.Startup.misc.lock_file import lock_file
+ from Zope2.Startup.misc.lock_file import lock_file
lock_filename = self.cfg.lock_filename
try:
if os.path.exists(lock_filename):
Modified: Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/run.py
===================================================================
--- Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/run.py 2005-01-29 21:24:35 UTC (rev 28975)
+++ Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/run.py 2005-01-29 21:44:39 UTC (rev 28976)
@@ -14,8 +14,8 @@
def run():
""" Start a Zope instance """
- import Zope.Startup
- starter = Zope.Startup.get_starter()
+ import Zope2.Startup
+ starter = Zope2.Startup.get_starter()
opts = _setconfig()
starter.setConfiguration(opts.configroot)
starter.prepare()
@@ -23,11 +23,11 @@
def configure(configfile):
""" Provide an API which allows scripts like zopectl to configure
- Zope before attempting to do 'app = Zope.app(). Should be used as
- follows: from Zope.Startup.run import configure;
- configure('/path/to/configfile'); import Zope; app = Zope.app() """
- import Zope.Startup
- starter = Zope.Startup.get_starter()
+ Zope before attempting to do 'app = Zope2.app(). Should be used as
+ follows: from Zope2.Startup.run import configure;
+ configure('/path/to/configfile'); import Zope2; app = Zope2.app() """
+ import Zope2.Startup
+ starter = Zope2.Startup.get_starter()
opts = _setconfig(configfile)
starter.setConfiguration(opts.configroot)
starter.setupSecurityOptions()
@@ -38,7 +38,7 @@
""" Configure a Zope instance based on ZopeOptions. Optionally
accept a configfile argument (string path) in order to specify
where the configuration file exists. """
- from Zope.Startup import options, handlers
+ from Zope2.Startup import options, handlers
from App import config
opts = options.ZopeOptions()
if configfile:
Modified: Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/__init__.py
===================================================================
--- Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/__init__.py 2005-01-29 21:24:35 UTC (rev 28975)
+++ Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/__init__.py 2005-01-29 21:44:39 UTC (rev 28976)
@@ -12,4 +12,4 @@
#
##############################################################################
-"""Tests of the Zope.Startup package."""
+"""Tests of the Zope2.Startup package."""
Modified: Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/testStarter.py
===================================================================
--- Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/testStarter.py 2005-01-29 21:24:35 UTC (rev 28975)
+++ Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/testStarter.py 2005-01-29 21:44:39 UTC (rev 28976)
@@ -25,7 +25,7 @@
from ZConfig.components.logger.tests import test_logger
from ZConfig.components.logger.loghandler import NullHandler
-import Zope.Startup
+import Zope2.Startup
from App.config import getConfiguration, setConfiguration
@@ -33,7 +33,7 @@
TEMPPRODUCTS = os.path.join(TEMPNAME, "Products")
def getSchema():
- startup = os.path.dirname(Zope.Startup.__file__)
+ startup = os.path.dirname(Zope2.Startup.__file__)
schemafile = os.path.join(startup, 'zopeschema.xml')
return ZConfig.loadSchema(schemafile)
@@ -70,7 +70,7 @@
logger.__dict__.update(logger_states[name])
def get_starter(self, conf):
- starter = Zope.Startup.get_starter()
+ starter = Zope2.Startup.get_starter()
starter.setConfiguration(conf)
return starter
Modified: Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/test_schema.py
===================================================================
--- Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/test_schema.py 2005-01-29 21:24:35 UTC (rev 28975)
+++ Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/test_schema.py 2005-01-29 21:44:39 UTC (rev 28976)
@@ -20,9 +20,9 @@
import unittest
import ZConfig
-import Zope.Startup
+import Zope2.Startup
-from Zope.Startup import datatypes
+from Zope2.Startup import datatypes
from App.config import getConfiguration
@@ -31,7 +31,7 @@
TEMPPRODUCTS = os.path.join(TEMPNAME, "Products")
def getSchema():
- startup = os.path.dirname(os.path.realpath(Zope.Startup.__file__))
+ startup = os.path.dirname(os.path.realpath(Zope2.Startup.__file__))
schemafile = os.path.join(startup, 'zopeschema.xml')
return ZConfig.loadSchema(schemafile)
Modified: Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/test_warnfilter.py
===================================================================
--- Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/test_warnfilter.py 2005-01-29 21:24:35 UTC (rev 28975)
+++ Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/tests/test_warnfilter.py 2005-01-29 21:44:39 UTC (rev 28976)
@@ -22,9 +22,9 @@
import warnings
import ZConfig
-import Zope.Startup
+import Zope2.Startup
-from Zope.Startup import datatypes
+from Zope2.Startup import datatypes
from App.config import getConfiguration
@@ -32,7 +32,7 @@
TEMPPRODUCTS = os.path.join(TEMPNAME, "Products")
def getSchema():
- startup = os.path.dirname(os.path.realpath(Zope.Startup.__file__))
+ startup = os.path.dirname(os.path.realpath(Zope2.Startup.__file__))
schemafile = os.path.join(startup, 'zopeschema.xml')
return ZConfig.loadSchema(schemafile)
@@ -75,7 +75,7 @@
<warnfilter>
action error
message .*test.*
- category Zope.Startup.tests.test_warnfilter.TestSchemaWarning
+ category Zope2.Startup.tests.test_warnfilter.TestSchemaWarning
module .*test_warnfilter.*
lineno 0
</warnfilter>
@@ -102,7 +102,7 @@
instancehome <<INSTANCE_HOME>>
<warnfilter>
action wontwork
- category Zope.Startup.tests.test_schema.TestSchemaWarning
+ category Zope2.Startup.tests.test_schema.TestSchemaWarning
</warnfilter>
""")
Modified: Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/zopectl.py
===================================================================
--- Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/zopectl.py 2005-01-29 21:24:35 UTC (rev 28975)
+++ Zope/branches/jim-move-Zope/lib/python/Zope2/Startup/zopectl.py 2005-01-29 21:44:39 UTC (rev 28976)
@@ -40,7 +40,7 @@
import signal
import zdaemon
-import Zope.Startup
+import Zope2.Startup
from zdaemon.zdctl import ZDCmd
from zdaemon.zdoptions import ZDOptions
@@ -60,7 +60,7 @@
positional_args_allowed = 1
program = "zopectl"
- schemadir = os.path.dirname(Zope.Startup.__file__)
+ schemadir = os.path.dirname(Zope2.Startup.__file__)
schemafile = "zopeschema.xml"
uid = gid = None
@@ -166,7 +166,7 @@
def do_debug(self, arg):
cmdline = self.get_startup_cmd(self.options.python + ' -i',
- 'import Zope; app=Zope.app()')
+ 'import Zope2; app=Zope2.app()')
print ('Starting debugger (the name "app" is bound to the top-level '
'Zope object)')
os.system(cmdline)
@@ -194,7 +194,7 @@
if len(tup) > 1:
argv = tup[1:]
cmd += '[sys.argv.append(x) for x in %s];' % argv
- cmd += 'import Zope; app=Zope.app(); execfile(\'%s\')' % script
+ cmd += 'import Zope2; app=Zope2.app(); execfile(\'%s\')' % script
cmdline = self.get_startup_cmd(self.options.python, cmd)
os.system(cmdline)
@@ -212,7 +212,7 @@
return
cmdline = self.get_startup_cmd(
self.options.python ,
- 'import Zope; app=Zope.app();'
+ 'import Zope2; app=Zope2.app();'
'app.acl_users._doAddUser(\'%s\', \'%s\', [\'Manager\'], []);'
'get_transaction().commit()'
) % (name, password)
Modified: Zope/branches/jim-move-Zope/lib/python/Zope2/__init__.py
===================================================================
--- Zope/branches/jim-move-Zope/lib/python/Zope2/__init__.py 2005-01-29 21:24:35 UTC (rev 28975)
+++ Zope/branches/jim-move-Zope/lib/python/Zope2/__init__.py 2005-01-29 21:44:39 UTC (rev 28976)
@@ -26,9 +26,9 @@
# This version is transitional. If you have a script that no longer
# works because it needs the database to be opened on calling "import
# Zope", you can set the environment variable ZOPE_COMPATIBLE_STARTUP
-# to a non-empty value. Then "import Zope" will automatically open
+# to a non-empty value. Then "import Zope2" will automatically open
# the database as it used to. Or better, update the script to call
-# Zope.startup() right after importing the Zope package. A future
+# Zope2.startup() right after importing the Zope package. A future
# version of Zope will remove this backward compatibility, since the
# old behavior is likely to cause problems as ZODB backends, like ZEO,
# gain new features.
@@ -43,7 +43,7 @@
return
_began_startup = 1
_configure()
- from Zope.App.startup import startup as _startup
+ from Zope2.App.startup import startup as _startup
_startup()
def app(*args, **kw):
@@ -57,7 +57,7 @@
import ZPublisher
return ZPublisher.test('Zope', *args, **kw)
-from Zope.Startup.run import configure
+from Zope2.Startup.run import configure
def _configure():
# Load configuration file from (optional) environment variable
@@ -67,7 +67,7 @@
if configfile is not None:
configure(configfile)
-# Zope.App.startup.startup() sets the following variables in this module.
+# Zope2.App.startup.startup() sets the following variables in this module.
DB = None
bobo_application = None
zpublisher_transactions_manager = None
More information about the Zope-Checkins
mailing list