Commit 2580fc77 authored by Jim Fulton's avatar Jim Fulton

Deprecated importing Zope (rather than Zope2).

Changed all imports of and references to the Zope to use Zope2 instead. 
parent 71b0533c
......@@ -22,8 +22,8 @@ from Testing.makerequest import makerequest
import transaction
import Zope
Zope.startup()
import Zope2
Zope2.startup()
from AccessControl import Unauthorized
from AccessControl.SecurityManagement import newSecurityManager
......@@ -36,7 +36,7 @@ class UserFolderTests(unittest.TestCase):
def setUp(self):
transaction.begin()
self.app = makerequest(Zope.app())
self.app = makerequest(Zope2.app())
try:
# Set up a user and role
self.uf = UserFolder().__of__(self.app)
......
......@@ -17,8 +17,8 @@
import os, sys, unittest
import Testing
import Zope
Zope.startup()
import Zope2
Zope2.startup()
import App.config
import App.FindHomes
......
......@@ -20,7 +20,7 @@ Usage: python pyskel.py dotted_name
Example:
cd lib/python
python Interface/pyskel.py Zope.App.Security.IRoleService.IRoleService
python Interface/pyskel.py Zope2.App.Security.IRoleService.IRoleService
The dotted name is the module name and interface object name connected
with a dot.
......
......@@ -16,7 +16,7 @@ import os, sys, unittest, tempfile, cStringIO
import ZODB
from OFS.Application import Application, AppInitializer, get_products
import Zope.Startup
import Zope2.Startup
import ZConfig
from App.config import getConfiguration, setConfiguration
......@@ -46,7 +46,7 @@ good_cfg = bad_cfg + """
"""
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)
......
import Testing
import Zope
Zope.startup()
import Zope2
Zope2.startup()
import os, sys
import unittest
......
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
import Zope2
Zope2.startup()
from Interface.Verify import verifyClass
from OFS.CopySupport import CopySource
......
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
import Zope2
Zope2.startup()
from Interface.Verify import verifyClass
from OFS.OrderedFolder import OrderedFolder
......
......@@ -16,7 +16,7 @@ import os, sys, unittest, tempfile, shutil, cStringIO
import ZODB
from OFS.Application import Application, AppInitializer, get_products
import Zope.Startup
import Zope2.Startup
import ZConfig
from App.config import getConfiguration, setConfiguration
......@@ -56,7 +56,7 @@ meta_types = ( {'name':'grabass', 'action':'amethod'}, )
"""
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)
......@@ -95,7 +95,7 @@ class TestProductInit( unittest.TestCase ):
text = text.replace("<<PRODUCTS2>>", TEMPPRODUCTS2)
sio = cStringIO.StringIO(text)
conf, handler = ZConfig.loadConfigFile(schema, sio)
from Zope.Startup.handlers import handleConfig
from Zope2.Startup.handlers import handleConfig
handleConfig(conf, handler)
self.assertEqual(conf.instancehome, TEMPNAME)
setConfiguration(conf)
......
......@@ -29,7 +29,7 @@ class DummyTranslationService:
return ustr(mapping[m.group(m.lastindex)])
cre = re.compile(r'\$(?:(%s)|\{(%s)\})' % (NAME_RE, NAME_RE))
return cre.sub(repl, default or msgid)
# XXX Not all of Zope.I18n.ITranslationService is implemented.
# XXX Not all of Zope2.I18n.ITranslationService is implemented.
translationService = DummyTranslationService()
......
......@@ -8,7 +8,7 @@ Note: Tests require Zope >= 2.7
import unittest
import Zope
import Zope2
import transaction
from Testing.makerequest import makerequest
......@@ -17,7 +17,7 @@ class ZPTRegressions(unittest.TestCase):
def setUp(self):
transaction.begin()
self.app = makerequest(Zope.app())
self.app = makerequest(Zope2.app())
f = self.app.manage_addProduct['PageTemplates'].manage_addPageTemplate
self._addPT = f
self.title = 'title of page template'
......
......@@ -11,7 +11,7 @@
#
##############################################################################
import Zope
import Zope2
import unittest
from DateTime import DateTime
......
......@@ -11,7 +11,7 @@
#
##############################################################################
import Zope
import Zope2
import unittest
import sys
......
import Zope
import Zope2
from ZPublisher.BeforeTraverse import NameCaller, rewriteBeforeTraverse
from Products.SiteAccess.AccessRule import AccessRule
......@@ -31,7 +31,7 @@ def _cvt_btr(app):
if __name__ == '__main__':
print "Converting SiteAccess objects from 1.x to 2.x ..."
app = Zope.app()
app = Zope2.app()
_cvt_btr(app)
get_transaction().commit()
print "Done."
......@@ -12,8 +12,8 @@ $Id$
from Testing.makerequest import makerequest
import Zope
Zope.startup()
import Zope2
Zope2.startup()
import transaction
......@@ -24,7 +24,7 @@ class VHMRegressions(unittest.TestCase):
def setUp(self):
transaction.begin()
self.app = makerequest(Zope.app())
self.app = makerequest(Zope2.app())
try:
#self.app.manage_addProduct['SiteAccess'].manage_addVirtualHostMonster('VHM')
# now we have a VHM as virtual_hosting per default
......
......@@ -7,8 +7,8 @@ $Id: testSiteErrorLog.py 27325 2004-08-29 09:59:28Z jens $
from Testing.makerequest import makerequest
import Zope
Zope.startup()
import Zope2
Zope2.startup()
import transaction
......@@ -20,7 +20,7 @@ class SiteErrorLogTests(unittest.TestCase):
def setUp(self):
transaction.begin()
self.app = makerequest(Zope.app())
self.app = makerequest(Zope2.app())
try:
self.app.manage_addDTMLMethod('doc', '')
except:
......
......@@ -207,7 +207,7 @@ def loadinc(name, mb, f, max=99999999, wait=1):
from ZODB.POSException import ConflictError
from time import sleep
from whrandom import uniform
import Zope, sys
import Zope2, sys
rconflicts=wconflicts=0
i=0
......@@ -218,7 +218,7 @@ def loadinc(name, mb, f, max=99999999, wait=1):
# sys.stderr.write("%s " % i)
# sys.stdout.flush()
if wait: sleep(uniform(0,wait))
jar=Zope.DB.open()
jar=Zope2.DB.open()
app=jar.root()['Application']
mdest=getattr(app, name)
if i%100 == 0 and VERBOSE:
......@@ -260,14 +260,14 @@ def loadinc(name, mb, f, max=99999999, wait=1):
def base():
try: os.unlink('../../var/Data.fs')
except: pass
import Zope
app=Zope.app()
import Zope2
app=Zope2.app()
if len(sys.argv) > 3:
max = atoi(sys.argv[3])
else:
max = -1
print do(Zope.DB, loadmail, (app, 'mail', sys.argv[2], max))
Zope.DB.close()
print do(Zope2.DB, loadmail, (app, 'mail', sys.argv[2], max))
Zope2.DB.close()
class RE:
def redirect(*args, **kw): pass
......@@ -281,9 +281,9 @@ def indexf(app):
def index():
os.environ['STUPID_LOG_FILE']=''
os.environ['STUPID_LOG_SEVERITY']='-111'
import Zope, Products.ZCatalog.ZCatalog
import Zope2, Products.ZCatalog.ZCatalog
import AccessControl.SecurityManagement, AccessControl.SpecialUsers
app=Zope.app()
app=Zope2.app()
Products.ZCatalog.ZCatalog.manage_addZCatalog(app, 'cat', '')
try:
app.cat.threshold = atoi(sys.argv[2])
......@@ -311,13 +311,13 @@ def index():
AccessControl.SecurityManagement.newSecurityManager(None, system)
r=RE()
r.PARENTS=[app.cat, app]
print do(Zope.DB, indexf, (app,))
print do(Zope2.DB, indexf, (app,))
#hist(sys.argv[2])
Zope.DB.close()
Zope2.DB.close()
def initmaili(n):
import Zope
app=Zope.app()
import Zope2
app=Zope2.app()
try:
import Products.BTreeFolder.BTreeFolder
except:
......@@ -329,8 +329,8 @@ def initmaili(n):
app._p_jar.close()
def hist(n):
import Zope
app=Zope.app()
import Zope2
app=Zope2.app()
import cPickle
pickler=cPickle.Pickler(open("h%s.hist" % n, 'w'))
h=app.cat._catalog.indexes['PrincipiaSearchSource'].histogram()
......@@ -339,7 +339,7 @@ def hist(n):
#pickler.dump(list(h))
def inc():
import Zope, thread
import Zope2, thread
min, max = atoi(sys.argv[3]), atoi(sys.argv[4])
count = max-min
try: threads=atoi(sys.argv[5])
......@@ -356,7 +356,7 @@ def inc():
omin=min
db=Zope.DB
db=Zope2.DB
size=db.getSize()
mem=VmSize()
......@@ -383,7 +383,7 @@ def inc():
argss.append((lock, (dest, mb, f, count, wait), returnf))
for lock, args, returnf in argss:
thread.start_new_thread(do, (Zope.DB, loadinc, args, returnf))
thread.start_new_thread(do, (Zope2.DB, loadinc, args, returnf))
for lock, args, returnf in argss:
lock.acquire()
......@@ -397,12 +397,12 @@ def inc():
#hist("%s-%s-%s" % (omin, count, threads))
Zope.DB.close()
Zope2.DB.close()
def catdel():
import Zope
app = Zope.app()
db = Zope.DB
import Zope2
app = Zope2.app()
db = Zope2.DB
t = time.time()
c = time.clock()
size = db.getSize()
......@@ -605,14 +605,14 @@ words=['banishment', 'indirectly', 'imprecise', 'peeks',
from ZODB.utils import u64
def incedit(edits, wait, ndel=20, nins=20):
import Zope, whrandom, string, time
import Zope2, whrandom, string, time
from ZODB.POSException import ConflictError
rconflicts=wconflicts=0
did=str(edits.pop())
while edits:
if wait: time.sleep(whrandom.uniform(0,wait))
jar=Zope.DB.open()
jar=Zope2.DB.open()
app=jar.root()['Application']
doc=getattr(app.mail, did)
......@@ -650,7 +650,7 @@ def incedit(edits, wait, ndel=20, nins=20):
return rconflicts, wconflicts
def edit():
import Zope, thread
import Zope2, thread
nedit, ndel, nins = atoi(sys.argv[2]), atoi(sys.argv[3]), atoi(sys.argv[4])
try: threads=atoi(sys.argv[5])
except:
......@@ -664,8 +664,8 @@ def edit():
if threads==1: start_new_thread=apply
else: start_new_thread=thread.start_new_thread
db=Zope.DB
app=Zope.app()
db=Zope2.DB
app=Zope2.app()
number_of_messages=app.mail.number_of_messages
app._p_jar.close()
......@@ -696,7 +696,7 @@ def edit():
argss.append((lock, (edits, wait, ndel, nins), returnf))
for lock, args, returnf in argss:
start_new_thread(do, (Zope.DB, incedit, args, returnf))
start_new_thread(do, (Zope2.DB, incedit, args, returnf))
for lock, args, returnf in argss:
lock.acquire()
......@@ -710,7 +710,7 @@ def edit():
#hist("e%s" % (threads))
Zope.DB.close()
Zope2.DB.close()
def VmSize():
try: f=open('/proc/%s/status' % os.getpid())
......
......@@ -16,7 +16,7 @@ os.environ['STUPID_LOG_FILE']= "debug.log"
here = os.getcwd()
import Zope
import Zope2
import ZODB, ZODB.FileStorage
from Products.ZCatalog import ZCatalog,Vocabulary
from Products.ZCatalog.Catalog import CatalogError
......
......@@ -17,7 +17,7 @@ os.environ['STUPID_LOG_FILE']=os.path.join(os.environ['INSTANCE_HOME'],'var',
'debug.log')
here = os.getcwd()
import Zope
import Zope2
import mailbox, time, httplib
from string import strip, find, split, lower, atoi, join
from urllib import quote
......@@ -36,7 +36,7 @@ TextTestRunner = VerboseTextTestRunner
class TestTimeIndex(TestCase):
def setUp(self):
self.app = makerequest(Zope.app())
self.app = makerequest(Zope2.app())
try: self.app._delObject('catalogtest')
except AttributeError: pass
self.app.manage_addFolder('catalogtest')
......
import os,sys
import unittest
import Zope
import Zope2
from Products.ZCatalog.ZCatalog import ZCatalog
from Products.PluginIndexes.TextIndex import Splitter
......
......@@ -17,8 +17,8 @@ $Id:$
import unittest
import Testing
import Zope
Zope.startup()
import Zope2
Zope2.startup()
from Interface.Verify import verifyClass
from itertools import chain
......
......@@ -38,7 +38,7 @@ class TestDBConfig:
def getDB(self):
from ZODB.config import DemoStorage
from ZODB.Connection import Connection
from Zope.Startup.datatypes import ZopeDatabase
from Zope2.Startup.datatypes import ZopeDatabase
self.name = self.fname
self.base = None
self.path = os.path.join(os.path.dirname(__file__), self.fname)
......
......@@ -24,8 +24,8 @@ from DocumentTemplate.DT_Util import ustr
IDomain = None
try:
from Zope.I18n.ITranslationService import ITranslationService
from Zope.I18n.IDomain import IDomain
from Zope2.I18n.ITranslationService import ITranslationService
from Zope2.I18n.IDomain import IDomain
except ImportError:
pass
if IDomain is None:
......
......@@ -7,9 +7,9 @@
#
# Typically used as in
#
# import ZopeLite as Zope
# Zope.installProduct('SomeProduct')
# app = Zope.app()
# import ZopeLite as Zope2
# Zope2.installProduct('SomeProduct')
# app = Zope2.app()
#
# $Id: ZopeLite.py,v 1.24 2004/08/18 09:28:54 shh42 Exp $
......@@ -53,10 +53,10 @@ config = App.config.getConfiguration()
config.debug_mode = 0
App.config.setConfiguration(config)
# Need to import Zope early on as the
# Need to import Zope2 early on as the
# ZTUtils package relies on it
_exec('import Zope')
import Zope
_exec('import Zope2')
import Zope2
_exec('import ZODB')
import ZODB
_write('.')
......@@ -96,7 +96,7 @@ from OFS.Application import get_folder_permissions, get_products, install_produc
from OFS.Folder import Folder
import Products
_theApp = Zope.app()
_theApp = Zope2.app()
_installedProducts = {}
def hasProduct(name):
......@@ -144,16 +144,16 @@ installProduct('OFSP', 1)
#installProduct('MailHost', 1)
# So people can use ZopeLite.app()
app = Zope.app
debug = Zope.debug
DB = Zope.DB
configure = Zope.configure
app = Zope2.app
debug = Zope2.debug
DB = Zope2.DB
configure = Zope2.configure
def startup(): pass
from ZODB.DemoStorage import DemoStorage
def sandbox(base=None):
'''Returns what amounts to a sandbox copy of the base ZODB.'''
if base is None: base = Zope.DB
if base is None: base = Zope2.DB
base_storage = base._storage
quota = getattr(base_storage, '_quota', None)
storage = DemoStorage(base=base_storage, quota=quota)
......
......@@ -4,7 +4,7 @@
# $Id: __init__.py,v 1.13 2004/08/19 15:52:55 shh42 Exp $
import ZopeLite as Zope
import ZopeLite as Zope2
import utils
from ZopeLite import installProduct
......
......@@ -4,7 +4,7 @@
# $Id: base.py,v 1.1 2004/08/19 13:59:41 shh42 Exp $
import ZopeLite as Zope
import ZopeLite as Zope2
import unittest
import transaction
......@@ -19,7 +19,7 @@ _connections = utils.ConnectionRegistry()
def app():
'''Opens a ZODB connection and returns the app object.'''
app = Zope.app()
app = Zope2.app()
_connections.register(app._p_jar)
return utils.makerequest(app)
......
......@@ -4,7 +4,7 @@
# $Id: sandbox.py,v 1.2 2004/08/19 15:31:26 shh42 Exp $
import ZopeLite as Zope
import ZopeLite as Zope2
import transaction
import utils
......@@ -19,7 +19,7 @@ class Sandboxed:
def _app(self):
'''Returns the app object for a test.'''
app = Zope.app(Zope.sandbox().open())
app = Zope2.app(Zope.sandbox().open())
AppZapper().set(app)
return utils.makerequest(app)
......
......@@ -17,7 +17,7 @@ ZODB objects
Usage:
import makerequest
app = makerequest.makerequest(Zope.app())
app = makerequest.makerequest(Zope2.app())
$Id$
......
......@@ -37,7 +37,7 @@ class Environment:
v = os.environ.get("INSTANCE_HOME")
if v is None:
# looking for a Zope/var directory assuming that this code
# is installed in Zope/lib/python/ZEO
# is installed in Zope2/lib/python/ZEO
p = parentdir(argv0, 4)
if os.path.isdir(os.path.join(p, "var")):
v = p
......
......@@ -69,12 +69,12 @@ It is instructive to watch what happens to the internal data structures
as changes are made. For example, in Zope, you can create an external
method::
import Zope
import Zope2
def info(RESPONSE):
RESPONSE['Content-type']= 'text/plain'
return Zope.DB._storage._splat()
return Zope2.DB._storage._splat()
and call it to monitor the storage.
......
from unittest import TestCase, TestSuite, makeSuite, main
import Zope
Zope.startup()
import Zope2
Zope2.startup()
from Acquisition import Implicit
from ZPublisher.BaseRequest import BaseRequest
......
......@@ -35,7 +35,7 @@ tracer = Tracer()
class TransactionsManager:
"""Mock TransactionManager to replace
Zope.App.startup.TransactionsManager.
Zope2.App.startup.TransactionsManager.
"""
def abort(self):
......@@ -55,7 +55,7 @@ zpublisher_transactions_manager = TransactionsManager()
def zpublisher_exception_hook(published, request, t, v, traceback):
"""Mock zpublisher_exception_hook to replace
Zope.App.startup.zpublisher_exception_hook
Zope2.App.startup.zpublisher_exception_hook
"""
if issubclass(t, ConflictError):
......
......@@ -18,3 +18,10 @@ $Id$
import sys, Zope2
sys.modules['Zope'] = Zope2
import warnings
warnings.warn("The Zope package has been renamed to Zope2.\n"
"Import of a package named 'Zope' is deprecated\n"
"and will be disabled starting in Zope 2.10.\n"
,
DeprecationWarning, stacklevel=2)
......@@ -385,7 +385,7 @@ class ZopeStarterTestCase(test_logger.LoggingTestBase):
sys.argv = [sys.argv[0]]
try:
fname = os.path.join(TEMPNAME, 'zope.conf')
from Zope import configure
from Zope2 import configure
f = open(fname, 'w')
f.write('instancehome %s\nzserver-threads 100\n' % TEMPNAME)
f.flush()
......
<component prefix="Zope.Startup.warnfilter">
<component prefix="Zope2.Startup.warnfilter">
<sectiontype name="warnfilter" datatype=".warning_filter_handler">
<key name="action" datatype=".warn_action" default="default"/>
<key name="message" default=""/>
......
<schema prefix="Zope.Startup.datatypes"
<schema prefix="Zope2.Startup.datatypes"
datatype=".root_config"
handler="root_handler">
......@@ -9,7 +9,7 @@
<import package="ZODB"/>
<import package="ZServer"/>
<import package="tempstorage"/>
<import package="Zope.Startup" file="warnfilter.xml"/>
<import package="Zope2.Startup" file="warnfilter.xml"/>
<sectiontype name="logger" datatype=".LoggerFactory">
<description>
......
......@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""ZODB undo support for Zope.
"""ZODB undo support for Zope2.
This package is used to support the Prefix object that Zope uses for
undo. It is a separate package only to aid configuration management.
......
......@@ -605,9 +605,9 @@ setup(
name='Zope',
author=AUTHOR,
packages=['Zope', 'Zope.App', 'Zope.Startup', 'Zope.Startup.misc',
'Zope.Startup.nt', 'Zope.Startup.tests'],
data_files=[ ['Zope/Startup', ['Zope/Startup/*.xml']] ],
packages=['Zope2', 'Zope2.App', 'Zope2.Startup', 'Zope2.Startup.misc',
'Zope2.Startup.nt', 'Zope2.Startup.tests'],
data_files=[ ['Zope2/Startup', ['Zope2/Startup/*.xml']] ],
)
# webdav
......
......@@ -8,6 +8,6 @@ SOFTWARE_HOME="<<SOFTWARE_HOME>>"
PYTHONPATH="$SOFTWARE_HOME"
export PYTHONPATH INSTANCE_HOME SOFTWARE_HOME
ZOPE_RUN="$SOFTWARE_HOME/Zope/Startup/run.py"
ZOPE_RUN="$SOFTWARE_HOME/Zope2/Startup/run.py"
exec "$PYTHON" "$ZOPE_RUN" -C "$CONFIG_FILE" "$@"
......@@ -8,6 +8,6 @@ SOFTWARE_HOME="<<SOFTWARE_HOME>>"
PYTHONPATH="$SOFTWARE_HOME"
export PYTHONPATH INSTANCE_HOME SOFTWARE_HOME
ZDCTL="$SOFTWARE_HOME/Zope/Startup/zopectl.py"
ZDCTL="$SOFTWARE_HOME/Zope2/Startup/zopectl.py"
exec "$PYTHON" "$ZDCTL" -C "$CONFIG_FILE" "$@"
......@@ -661,8 +661,8 @@ def main(module_filter, test_filter, libdir):
if config_file:
config_file = os.path.realpath(config_file)
print "Parsing %s" % config_file
import Zope
Zope.configure(config_file)
import Zope2
Zope2.configure(config_file)
if not keepStaleBytecode:
from App.config import getConfiguration
......
......@@ -197,10 +197,10 @@ def setup(lib_python):
os.remove(os.path.join(lib_python, '..', '..', 'var', 'Data.fs'))
except:
pass
import Zope
import Zope2
import Products
import AccessControl.SecurityManagement
app=Zope.app()
app=Zope2.app()
Products.ZCatalog.ZCatalog.manage_addZCatalog(app, 'cat', '')
......@@ -279,16 +279,16 @@ def run1(tid, db, factory, job, args):
factory.__name__, r)
def run(jobs, tid=''):
import Zope
import Zope2
while 1:
factory, job, args, repeatp = jobs.next()
run1(tid, Zope.DB, factory, job, args)
run1(tid, Zope2.DB, factory, job, args)
if repeatp:
while 1:
i = random.randint(0,100)
if i > repeatp:
break
run1(tid, Zope.DB, factory, job, args)
run1(tid, Zope2.DB, factory, job, args)
def index(connection, messages, catalog):
......@@ -733,8 +733,8 @@ def main(args=None):
if options.has_key('setup'):
setup(lib_python)
else:
import Zope
Zope.startup()
import Zope2
Zope2.startup()
#from ThreadedAsync.LoopCallback import loop
#threading.Thread(target=loop, args=(), name='asyncore').start()
......
......@@ -15,7 +15,7 @@
$Id$
"""
import Zope
import Zope2
import os,sys,re,getopt
from types import IntType
from BTrees.IIBTree import IISet,difference,intersection
......@@ -23,7 +23,7 @@ from BTrees.IIBTree import IISet,difference,intersection
def checkCatalog(path,indexes):
""" perform some consistency checks on a ZCatalog instance"""
root = Zope.app()
root = Zope2.app()
try:
catalog = root.unrestrictedTraverse(path)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment