[Zope-Checkins] SVN: Zope/branches/tseaver-no_globals_imports/ Branch for removing imports from the Globals module.
Tres Seaver
tseaver at palladion.com
Fri Dec 26 22:27:24 EST 2008
Log message for revision 94367:
Branch for removing imports from the Globals module.
Changed:
A Zope/branches/tseaver-no_globals_imports/
U Zope/branches/tseaver-no_globals_imports/doc/CHANGES.txt
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/ImplPython.py
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/Owned.py
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/Permission.py
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/PermissionMapping.py
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/Role.py
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/User.py
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/__init__.py
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testAcquisition.py
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testBindings.py
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testClassSecurityInfo.py
U Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testZopeGuards.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/ApplicationManager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/CacheManager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/DavLockManager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/Dialogs.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/Factory.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/FactoryDispatcher.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/ImageFile.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/Management.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/Permission.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/PersistentExtra.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/Product.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/ProductContext.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/Undo.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/class_init.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/testPersistentExtra.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_cachemanager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_class_init.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_setConfiguration.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_version_txt.py
U Zope/branches/tseaver-no_globals_imports/lib/python/App/version_txt.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Globals/__init__.py
U Zope/branches/tseaver-no_globals_imports/lib/python/HelpSys/APIHelpTopic.py
U Zope/branches/tseaver-no_globals_imports/lib/python/HelpSys/HelpSys.py
U Zope/branches/tseaver-no_globals_imports/lib/python/HelpSys/HelpTopic.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Application.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Cache.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/CopySupport.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/DTMLDocument.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/DTMLMethod.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/FindSupport.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Folder.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/History.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Image.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/ObjectManager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/OrderSupport.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/OrderedFolder.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/PropertyManager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/PropertySheets.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/SimpleItem.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Traversable.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Uninstalled.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/ZDOM.py
U Zope/branches/tseaver-no_globals_imports/lib/python/OFS/misc_.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/BTreeFolder2/BTreeFolder2.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ExternalMethod/ExternalMethod.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/browser/metaconfigure.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/form/metaconfigure.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/security.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/tests/test_security.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/viewlet/metaconfigure.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/MailHost/MailHost.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/OFSP/Draft.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/OFSP/Version.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PageTemplates/PageTemplateFile.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PageTemplates/ZopePageTemplate.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/FieldIndex/FieldIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/KeywordIndex/KeywordIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/GlobbingLexicon.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/Lexicon.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/Vocabulary.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TopicIndex/FilteredSet.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TopicIndex/TopicIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/__init__.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/common/ResultList.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/common/UnIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/common/util.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PythonScripts/PythonScript.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/PythonScripts/standard.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/Sessions/BrowserIdManager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/Sessions/SessionDataManager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteAccess/AccessRule.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteAccess/SiteRoot.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteAccess/VirtualHostMonster.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteErrorLog/SiteErrorLog.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/StandardCacheManagers/AcceleratedHTTPCacheManager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/StandardCacheManagers/RAMCacheManager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/Transience/Transience.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/Transience/TransientObject.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/BaseIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/CosineIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/HTMLSplitter.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/Lexicon.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/OkapiIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/ParseTree.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/QueryParser.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/SetOps.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/ZCTextIndex.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/CatalogAwareness.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/CatalogPathAwareness.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/ZCatalog.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/ZCatalogIndexes.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZReST/ZReST.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZSQLMethods/SQL.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/Scripts/Bindings.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/Scripts/BindingsUI.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/Scripts/Script.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/ZRDB/Aqueduct.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/ZRDB/DA.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/ZRDB/Search.py
D Zope/branches/tseaver-no_globals_imports/lib/python/Signals/Signals.py
A Zope/branches/tseaver-no_globals_imports/lib/python/Signals/Signals.py
U Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/Basic.py
U Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/Method.py
U Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/ObjectManager.py
U Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/Property.py
U Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/ZClass.py
U Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/ZClassOwner.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Zope2/App/startup.py
U Zope/branches/tseaver-no_globals_imports/lib/python/Zope2/Startup/__init__.py
U Zope/branches/tseaver-no_globals_imports/lib/python/webdav/Collection.py
U Zope/branches/tseaver-no_globals_imports/lib/python/webdav/LockItem.py
U Zope/branches/tseaver-no_globals_imports/lib/python/webdav/Lockable.py
U Zope/branches/tseaver-no_globals_imports/lib/python/webdav/NullResource.py
U Zope/branches/tseaver-no_globals_imports/lib/python/webdav/Resource.py
U Zope/branches/tseaver-no_globals_imports/lib/python/webdav/common.py
U Zope/branches/tseaver-no_globals_imports/lib/python/webdav/davcmds.py
-=-
Modified: Zope/branches/tseaver-no_globals_imports/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/doc/CHANGES.txt 2008-12-27 03:27:23 UTC (rev 94367)
@@ -9,6 +9,11 @@
Restructuring
+ - Replaced imports from the 'Globals' module throughout the
+ tree with imports from the actual modules; the 'Globals' module
+ was always intended to be an area for shared data, rather than
+ a "facade" for imports.
+
- Updated 'pytz' from '2007f' to '2008i'.
- Moved svn:externals for 'mechanize', 'ClientPath', and 'pytz' to
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/ImplPython.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/ImplPython.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/ImplPython.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,8 +17,11 @@
import string
from logging import getLogger
-from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire
+from Acquisition import aq_acquire
+from Acquisition import aq_base
+from Acquisition import aq_inner
from Acquisition import aq_inContextOf
+from Acquisition import aq_parent
from ExtensionClass import Base
from zope.interface import implements
@@ -31,10 +34,11 @@
_what_not_even_god_should_do = []
from AccessControl.SecurityManagement import getSecurityManager
-from AccessControl import Unauthorized
+from AccessControl.unauthorized import Unauthorized
from AccessControl.interfaces import ISecurityPolicy
from AccessControl.interfaces import ISecurityManager
-from AccessControl.SimpleObjectPolicies import Containers, _noroles
+from AccessControl.SimpleObjectPolicies import Containers
+from AccessControl.SimpleObjectPolicies import _noroles
from AccessControl.ZopeGuards import guarded_getitem
LOG = getLogger('ImplPython')
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/Owned.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/Owned.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/Owned.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,20 +14,27 @@
$Id$
"""
+import urlparse
-import Globals, urlparse, SpecialUsers, ExtensionClass
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
-from AccessControl import getSecurityManager, Unauthorized
+from Acquisition import aq_base
+from Acquisition import aq_get
+from Acquisition import aq_inner
+from Acquisition import aq_parent
+from App.special_dtml import DTMLFile
+from App.class_init import default__class_init__ as InitializeClass
+from ExtensionClass import Base
+from zope.interface import implements
+
+from AccessControl.interfaces import IOwned
from AccessControl.Permissions import view_management_screens
from AccessControl.Permissions import take_ownership
-from Acquisition import aq_get, aq_parent, aq_base, aq_inner
-from requestmethod import requestmethod
-from zope.interface import implements
+from AccessControl.requestmethod import requestmethod
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl import SpecialUsers as SU
+from AccessControl.unauthorized import Unauthorized
-from interfaces import IOwned
-
UnownableOwner=[]
def ownableFilter(self):
_owner = aq_get(self, '_owner', None, 1)
@@ -36,7 +43,7 @@
# Marker to use as a getattr default.
_mark=ownableFilter
-class Owned(ExtensionClass.Base):
+class Owned(Base):
implements(IOwned)
@@ -51,7 +58,7 @@
)
security.declareProtected(view_management_screens, 'manage_owner')
- manage_owner=Globals.DTMLFile('dtml/owner', globals())
+ manage_owner = DTMLFile('dtml/owner', globals())
security.declareProtected(view_management_screens, 'owner_info')
def owner_info(self):
@@ -97,10 +104,10 @@
root=self.getPhysicalRoot()
udb=root.unrestrictedTraverse(udb, None)
if udb is None:
- user = SpecialUsers.nobody
+ user = SU.nobody
else:
user = udb.getUserById(oid, None)
- if user is None: user = SpecialUsers.nobody
+ if user is None: user = SU.nobody
return user
security.declarePrivate('getOwnerTuple')
@@ -134,12 +141,12 @@
udb = root.unrestrictedTraverse(udb_path, None)
if udb is None:
- return SpecialUsers.nobody
+ return SU.nobody
user = udb.getUserById(oid, None)
if user is None:
- return SpecialUsers.nobody
+ return SU.nobody
return user.__of__(udb)
@@ -258,8 +265,7 @@
else:
# Otherwise change the ownership
user=getSecurityManager().getUser()
- if (SpecialUsers.emergency_user and
- aq_base(user) is SpecialUsers.emergency_user):
+ if (SU.emergency_user and aq_base(user) is SU.emergency_user):
__creatable_by_emergency_user__=getattr(
self,'__creatable_by_emergency_user__', None)
if (__creatable_by_emergency_user__ is None or
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/Permission.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/Permission.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/Permission.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -121,6 +121,7 @@
def registerPermissions(permissions, defaultDefault=('Manager',)):
"""Register an __ac_permissions__ sequence.
"""
+ from App.class_init import ApplicationDefaultPermissions
for setting in permissions:
if _registerdPermission(setting[0]): continue
if len(setting)==2:
@@ -133,6 +134,6 @@
Products.__ac_permissions__=(
Products_permissions + ((perm, (), default),))
mangled=pname(perm) # get mangled permission name
- if not hasattr(Globals.ApplicationDefaultPermissions, mangled):
- setattr(Globals.ApplicationDefaultPermissions,
+ if not hasattr(ApplicationDefaultPermissions, mangled):
+ setattr(ApplicationDefaultPermissions,
mangled, default)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/PermissionMapping.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/PermissionMapping.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/PermissionMapping.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -21,16 +21,16 @@
from cgi import escape
-import ExtensionClass, Acquisition
-from Globals import InitializeClass
+from Acquisition import ImplicitAcquisitionWrapper
+from App.class_init import default__class_init__ as InitializeClass
+from ExtensionClass import Base
from zope.interface import implements
-from interfaces import IPermissionMappingSupport
-from Owned import UnownableOwner
-from Permission import pname
-from requestmethod import requestmethod
+from AccessControl.interfaces import IPermissionMappingSupport
+from AccessControl.Owned import UnownableOwner
+from AccessControl.Permission import pname
+from AccessControl.requestmethod import requestmethod
-
class RoleManager:
implements(IPermissionMappingSupport)
@@ -125,7 +125,7 @@
if v: setattr(obj, name, pname(v))
elif obj.__dict__.has_key(name): delattr(obj, name)
-class PM(ExtensionClass.Base):
+class PM(Base):
_owner=UnownableOwner
_View_Permission='_View_Permission'
@@ -144,23 +144,23 @@
r._ugh=wrapper, object, parent
return r
-class Rewrapper(ExtensionClass.Base):
+class Rewrapper(Base):
def __of__(self, parent):
w, m, p = self._ugh
return m.__of__(
- Acquisition.ImplicitAcquisitionWrapper(
+ ImplicitAcquisitionWrapper(
w, parent))
def __getattr__(self, name):
w, m, parent = self._ugh
self=m.__of__(
- Acquisition.ImplicitAcquisitionWrapper(
+ ImplicitAcquisitionWrapper(
w, parent))
return getattr(self, name)
def __call__(self, *args, **kw):
w, m, parent = self._ugh
self=m.__of__(
- Acquisition.ImplicitAcquisitionWrapper(
+ ImplicitAcquisitionWrapper(
w, parent))
return apply(self, args, kw)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/Role.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/Role.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/Role.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -16,21 +16,24 @@
"""
from cgi import escape
-from Globals import DTMLFile, MessageDialog, Dictionary
-from Acquisition import Implicit, Acquired, aq_get
-from Globals import InitializeClass
+from Acquisition import Acquired
+from Acquisition import aq_get
+from Acquisition import aq_base
+from Acquisition import Implicit
from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.Permissions import change_permissions
-import ExtensionClass, PermissionMapping, Products
-from App.Common import aq_base
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
+from ExtensionClass import Base
+from PermissionMapping import RoleManager
from zope.interface import implements
-from interfaces import IRoleManager
-from Permission import Permission
-from requestmethod import requestmethod
+from AccessControl.interfaces import IRoleManager
+from AccessControl.Permission import Permission
+from AccessControl.requestmethod import requestmethod
-
DEFAULTMAXLISTUSERS=250
def _isBeingUsedAsAMethod(self):
@@ -40,7 +43,7 @@
return not aq_get(self, '_isBeingUsedAsAMethod_', 0)
-class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager):
+class RoleManager(Base, RoleManager):
"""An object that has configurable permissions"""
@@ -602,6 +605,7 @@
pass
def possible_permissions(self):
+ import Products
d={}
Products_permissions = getattr(Products, '__ac_permissions__', ())
for p in Products_permissions:
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/User.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/User.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/User.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -24,12 +24,16 @@
from Acquisition import aq_parent
from Acquisition import aq_inContextOf
from Acquisition import Implicit
-from App.Management import Navigation, Tabs
-from Globals import DTMLFile, MessageDialog, Persistent, PersistentMapping
-from Globals import InitializeClass
+from App.class_init import default__class_init__ as InitializeClass
+from App.Management import Navigation
+from App.Management import Tabs
+from App.special_dtml import DTMLFile
+from App.Dialogs import MessageDialog
from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import manage_users as ManageUsers
from OFS.SimpleItem import Item
+from Persistence import Persistent
+from Persistence import PersistentMapping
from zExceptions import Unauthorized, BadRequest
from zope.interface import implements
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/__init__.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/__init__.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/__init__.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -11,21 +11,26 @@
#
##############################################################################
-from unauthorized import Unauthorized
# This has to happen early so things get initialized properly
from AccessControl.Implementation import setImplementation
-from AccessControl.SecurityManagement import getSecurityManager, setSecurityPolicy
-from AccessControl.SecurityInfo import ClassSecurityInfo, ModuleSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.SecurityManagement import setSecurityPolicy
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityInfo import ModuleSecurityInfo
from AccessControl.SecurityInfo import ACCESS_PRIVATE
from AccessControl.SecurityInfo import ACCESS_PUBLIC
from AccessControl.SecurityInfo import ACCESS_NONE
-from AccessControl.SecurityInfo import secureModule, allow_module, allow_class
+from AccessControl.SecurityInfo import secureModule
+from AccessControl.SecurityInfo import allow_module
+from AccessControl.SecurityInfo import allow_class
from AccessControl.SimpleObjectPolicies import allow_type
-from AccessControl.ZopeGuards import full_write_guard, safe_builtins
+from AccessControl.unauthorized import Unauthorized # XXX
+from AccessControl.ZopeGuards import full_write_guard
+from AccessControl.ZopeGuards import safe_builtins
ModuleSecurityInfo('AccessControl').declarePublic('getSecurityManager')
-from AccessControl import DTML
+from AccessControl import DTML # XXX side effects?
del DTML
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testAcquisition.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/tests/testAcquisition.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testAcquisition.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -25,7 +25,7 @@
Zope2.startup()
from OFS.SimpleItem import SimpleItem
-from Globals import InitializeClass
+from App.class_init import default__class_init__ as InitializeClass
from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testBindings.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/tests/testBindings.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testBindings.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -21,7 +21,7 @@
import transaction
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo
-from Globals import InitializeClass
+from App.class_init import default__class_init__ as InitializeClass
from OFS.ObjectManager import ObjectManager
from OFS.Folder import Folder
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testClassSecurityInfo.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/tests/testClassSecurityInfo.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testClassSecurityInfo.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -28,7 +28,7 @@
# Test setting default roles for permissions.
- import Globals # XXX: avoiding import cycle
+ #import Globals # XXX: avoiding import cycle
from App.class_init import default__class_init__
from ExtensionClass import Base
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testZopeGuards.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/tests/testZopeGuards.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/AccessControl/tests/testZopeGuards.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -585,7 +585,7 @@
from AccessControl.SecurityInfo import ClassSecurityInfo
from ExtensionClass import Base
- from Globals import InitializeClass
+ from App.class_init import default__class_init__ as InitializeClass
global _ProtectedBase
if _ProtectedBase is None:
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/ApplicationManager.py
===================================================================
--- Zope/trunk/lib/python/App/ApplicationManager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/ApplicationManager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,27 +14,33 @@
__version__='$Revision: 1.94 $'[11:-2]
-import sys,os,time,Globals, Acquisition, os, Undo
+from cgi import escape
+from cStringIO import StringIO
from logging import getLogger
-from Globals import InitializeClass
-from Globals import DTMLFile
-from OFS.ObjectManager import ObjectManager
-from OFS.Folder import Folder
-from CacheManager import CacheManager
-from DavLockManager import DavLockManager
-from DateTime.DateTime import DateTime
-from OFS import SimpleItem
+import os
+import sys
+import time
+
+from AccessControl.requestmethod import requestmethod
+from AccessControl.SecurityManagement import getSecurityManager
+from Acquisition import Implicit
+from App.CacheManager import CacheManager
+from App.class_init import default__class_init__ as InitializeClass
from App.config import getConfiguration
+from App.DavLockManager import DavLockManager
from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
+from App.Undo import UndoSupport
+from App.version_txt import version_txt
+from DateTime.DateTime import DateTime
+from Lifetime import shutdown
+from OFS.Folder import Folder
+from OFS.ObjectManager import ObjectManager
+from OFS.SimpleItem import Item
+from OFS.SimpleItem import SimpleItem
from Product import ProductFolder
-from version_txt import version_txt
-from cStringIO import StringIO
-from AccessControl import getSecurityManager
-from AccessControl.requestmethod import requestmethod
+from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zExceptions import Redirect
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
-from cgi import escape
-import Lifetime
LOG = getLogger('ApplicationManager')
@@ -45,9 +51,9 @@
class Fake:
def locked_in_version(self): return 0
-class DatabaseManager(Fake, SimpleItem.Item, Acquisition.Implicit):
+class DatabaseManager(Fake, Item, Implicit):
"""Database management (legacy) """
- manage=manage_main=DTMLFile('dtml/dbMain', globals())
+ manage = manage_main = DTMLFile('dtml/dbMain', globals())
manage_main._setName('manage_main')
id ='DatabaseManagement'
name=title='Database Management'
@@ -69,9 +75,9 @@
# These need to be here rather to make tabs work correctly. This
# needs to be revisited.
- manage_activity=Globals.DTMLFile('dtml/activity', globals())
- manage_cacheParameters=Globals.DTMLFile('dtml/cacheParameters', globals())
- manage_cacheGC=Globals.DTMLFile('dtml/cacheGC', globals())
+ manage_activity = DTMLFile('dtml/activity', globals())
+ manage_cacheParameters = DTMLFile('dtml/cacheParameters', globals())
+ manage_cacheGC = DTMLFile('dtml/cacheGC', globals())
InitializeClass(DatabaseManager)
@@ -89,7 +95,7 @@
def getVersion(self):
return self.version
-class DatabaseChooser (SimpleItem.SimpleItem):
+class DatabaseChooser(SimpleItem):
"""Lets you choose which database to view
"""
meta_type = 'Database Management'
@@ -140,9 +146,9 @@
InitializeClass(DatabaseChooser)
-class VersionManager(Fake, SimpleItem.Item, Acquisition.Implicit):
+class VersionManager(Fake, Item, Implicit):
"""Version management"""
- manage=manage_main=DTMLFile('dtml/versionManager', globals())
+ manage=manage_main = DTMLFile('dtml/versionManager', globals())
manage_main._setName('manage_main')
id ='Versions'
name=title='Version Management'
@@ -165,9 +171,9 @@
_v_rcs=None
_v_rst=None
-class DebugManager(Fake, SimpleItem.Item, Acquisition.Implicit):
+class DebugManager(Fake, Item, Implicit):
"""Debug and profiling information"""
- manage=manage_main=DTMLFile('dtml/debug', globals())
+ manage=manage_main = DTMLFile('dtml/debug', globals())
manage_main._setName('manage_main')
id ='DebugInfo'
name=title='Debug Information'
@@ -182,9 +188,9 @@
)
)
- manage_debug=DTMLFile('dtml/debug', globals())
+ manage_debug = DTMLFile('dtml/debug', globals())
- def refcount(self, n=None, t=(type(Fake), type(Acquisition.Implicit))):
+ def refcount(self, n=None, t=(type(Fake), type(Implicit))):
# return class reference info
dict={}
for m in sys.modules.values():
@@ -241,12 +247,13 @@
'rc': n[1][0]}, rd)
def dbconnections(self):
+ import Globals
return Globals.DB.connectionDebugInfo()
# Profiling support
- manage_profile=DTMLFile('dtml/profile', globals())
+ manage_profile = DTMLFile('dtml/profile', globals())
def manage_profile_stats(self, sort='time', limit=200, stripDirs=1, mode='stats'):
"""Return profile data if available"""
@@ -283,7 +290,7 @@
DebugInfo=DebugManager()
DavLocks = DavLockManager()
- manage=manage_main=DTMLFile('dtml/cpContents', globals())
+ manage=manage_main = DTMLFile('dtml/cpContents', globals())
manage_main._setName('manage_main')
def version_txt(self):
@@ -309,12 +316,10 @@
)
manage_options=(
- (
- {'label':'Contents', 'action':'manage_main',
- 'help':('OFSP','Control-Panel_Contents.stx')},
+ ({'label':'Contents', 'action':'manage_main',
+ 'help':('OFSP','Control-Panel_Contents.stx')},
+ ) + UndoSupport.manage_options
)
- +Undo.UndoSupport.manage_options
- )
id ='Control_Panel'
name=title='Control Panel'
@@ -397,8 +402,7 @@
except:
user = 'unknown user'
LOG.info("Restart requested by %s" % user)
- #for db in Globals.opened: db.close()
- Lifetime.shutdown(1)
+ shutdown(1)
return """<html>
<head><meta HTTP-EQUIV=REFRESH CONTENT="10; URL=%s/manage_main">
</head>
@@ -413,8 +417,7 @@
except:
user = 'unknown user'
LOG.info("Shutdown requested by %s" % user)
- #for db in Globals.opened: db.close()
- Lifetime.shutdown(0)
+ shutdown(0)
return """<html>
<head>
</head>
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/CacheManager.py
===================================================================
--- Zope/trunk/lib/python/App/CacheManager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/CacheManager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -19,9 +19,10 @@
import time
-import Globals
-from Globals import InitializeClass
-from DateTime import DateTime
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from App.ImageFile import ImageFile
+from DateTime.DateTime import DateTime
class CacheManager:
"""Cache management mix-in
@@ -30,13 +31,12 @@
_vcache_age = 60
_history_length = 3600 # Seconds
- manage_cacheParameters = Globals.DTMLFile('dtml/cacheParameters',
- globals())
- manage_cacheGC = Globals.DTMLFile('dtml/cacheGC', globals())
+ manage_cacheParameters = DTMLFile('dtml/cacheParameters', globals())
+ manage_cacheGC = DTMLFile('dtml/cacheGC', globals())
- transparent_bar = Globals.ImageFile('www/transparent_bar.gif', globals())
- store_bar = Globals.ImageFile('www/store_bar.gif', globals())
- load_bar = Globals.ImageFile('www/load_bar.gif', globals())
+ transparent_bar = ImageFile('www/transparent_bar.gif', globals())
+ store_bar = ImageFile('www/store_bar.gif', globals())
+ load_bar = ImageFile('www/load_bar.gif', globals())
def _getDB(self):
return self._p_jar.db()
@@ -95,18 +95,22 @@
# BoboPOS 2
def cache_mean_age(self):
+ import Globals
return Globals.Bobobase._jar.cache.cache_mean_age/60.0
# BoboPOS 2
def cache_mean_deal(self):
+ import Globals
return Globals.Bobobase._jar.cache.cache_mean_deal*60
# BoboPOS 2
def cache_mean_deac(self):
+ import Globals
return Globals.Bobobase._jar.cache.cache_mean_deac*60
# BoboPOS 2
def cache_last_gc_time(self):
+ import Globals
t=Globals.Bobobase._jar.cache.cache_last_gc_time
return time.asctime(time.localtime(t))
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/DavLockManager.py
===================================================================
--- Zope/trunk/lib/python/App/DavLockManager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/DavLockManager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -13,15 +13,19 @@
__version__ = "$Revision: 1.8 $"[11:-2]
-import OFS, Acquisition, Globals
-from Globals import InitializeClass
-from AccessControl import getSecurityManager, ClassSecurityInfo
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from Acquisition import aq_base
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from OFS.SimpleItem import Item
from webdav.Lockable import wl_isLocked
-class DavLockManager(OFS.SimpleItem.Item, Acquisition.Implicit):
- id = 'DavLockManager'
+class DavLockManager(Item, Implicit):
+ id = 'DavLockManager'
name = title = 'WebDAV Lock Manager'
- meta_type = 'WebDAV Lock Manager'
+ meta_type = 'WebDAV Lock Manager'
icon = 'p_/davlocked'
security = ClassSecurityInfo()
@@ -30,7 +34,7 @@
'manage_unlockObjects')
security.declarePrivate('unlockObjects')
- manage_davlocks=manage_main=manage=Globals.DTMLFile(
+ manage_davlocks = manage_main = manage = DTMLFile(
'dtml/davLockManager', globals())
manage_davlocks._setName('manage_davlocks')
@@ -78,7 +82,7 @@
if result is None:
result = []
- base = Acquisition.aq_base(obj)
+ base = aq_base(obj)
if not hasattr(base, 'objectItems'):
return result
try: items = obj.objectItems()
@@ -90,7 +94,7 @@
else: p = id
dflag = hasattr(ob, '_p_changed') and (ob._p_changed == None)
- bs = Acquisition.aq_base(ob)
+ bs = aq_base(ob)
if wl_isLocked(ob):
li = []
addlockinfo = li.append
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/Dialogs.py
===================================================================
--- Zope/trunk/lib/python/App/Dialogs.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/Dialogs.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -33,9 +33,8 @@
__version__='$Revision: 1.9 $'[11:-2]
+from App.special_dtml import HTML
-from Globals import HTML
-
MessageDialog = HTML("""
<HTML>
<HEAD>
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/Factory.py
===================================================================
--- Zope/trunk/lib/python/App/Factory.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/Factory.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,34 +15,41 @@
$Id$'''
__version__='$Revision: 1.27 $'[11:-2]
-import OFS.SimpleItem, Acquisition, Globals, AccessControl.Role
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import edit_factories
from AccessControl.Permissions import use_factories
+from AccessControl.Role import RoleManager
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Acquired
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from Persistence import Persistent
+from OFS.SimpleItem import Item
-class Factory(
- AccessControl.Role.RoleManager,
- Globals.Persistent, Acquisition.Implicit, OFS.SimpleItem.Item
- ):
- "Model factory meta-data"
- meta_type='Zope Factory'
- icon='p_/Factory_icon'
+class Factory(RoleManager,
+ Persistent,
+ Implicit,
+ Item
+ ):
+ """Model factory meta-data
+ """
+ meta_type = 'Zope Factory'
+ icon = 'p_/Factory_icon'
security = ClassSecurityInfo()
security.declareObjectProtected(use_factories)
- permission='' # Waaaa
+ permission = '' # Waaaa
- _setObject=_getOb=Acquisition.Acquired
+ _setObject=_getOb = Acquired
- manage_options=(
+ manage_options = (
(
{'label':'Edit', 'action':'manage_main',
'help':('OFSP','Zope-Factory_Edit.stx')},
)
- +AccessControl.Role.RoleManager.manage_options
- +OFS.SimpleItem.Item.manage_options
+ + RoleManager.manage_options
+ + Item.manage_options
)
def __init__(self, id, title, object_type, initial, permission=''):
@@ -62,53 +69,55 @@
REQUEST=None):
"Modify factory properties."
self._unregister()
- self.title=title
- self.object_type=object_type
- self.initial=initial
- self.permission=permission
+ self.title = title
+ self.object_type = object_type
+ self.initial = initial
+ self.permission = permission
self.manage_setPermissionMapping((use_factories,), (permission,))
self._register()
- if REQUEST is not None: return self.manage_main(self, REQUEST)
+ if REQUEST is not None:
+ return self.manage_main(self, REQUEST)
def manage_afterAdd(self, item, container):
- import Product # local to avoid circular import
+ from App.Product import Product # local to avoid circular import
if hasattr(self, 'aq_parent'):
container=self.aq_parent
elif item is not self:
container=None
if (item is self or
- getattr(container, '__class__', None) is Product.Product):
+ getattr(container, '__class__', None) is Product):
self._register()
def manage_beforeDelete(self, item, container):
- import Product # local to avoid circular import
+ from App.Product import Product # local to avoid circular import
if hasattr(self, 'aq_parent'):
container=self.aq_parent
elif item is not self:
container=None
if (item is self or
- getattr(container, '__class__', None) is Product.Product):
+ getattr(container, '__class__', None) is Product):
self._unregister()
def _register(self):
# Register with the product folder
- product=self.aq_parent
+ product =self.aq_parent
product.aq_acquire('_manage_add_product_meta_type')(
product, self.id, self.object_type, self.permission)
def _unregister(self):
# Unregister with the product folder
- product=self.aq_parent
+ product = self.aq_parent
product.aq_acquire('_manage_remove_product_meta_type')(
product, self.id, self.object_type)
security.declareProtected(edit_factories, 'manage_main')
- manage_main=Globals.DTMLFile('dtml/editFactory',globals())
+ manage_main = DTMLFile('dtml/editFactory',globals())
security.declareProtected(use_factories, 'index_html')
def index_html(self, REQUEST):
- " "
+ """ Main factory view
+ """
return getattr(self, self.initial)(self.aq_parent, REQUEST)
def objectIds(self):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/FactoryDispatcher.py
===================================================================
--- Zope/trunk/lib/python/App/FactoryDispatcher.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/FactoryDispatcher.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -13,19 +13,22 @@
# Implement the manage_addProduct method of object managers
+import sys
import types
-import Acquisition, sys, Products
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
+
+from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.PermissionMapping import aqwrap
from AccessControl.Owned import UnownableOwner
-import Zope2
+from Acquisition import Acquired
+from Acquisition import aq_base
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
def _product_packages():
"""Returns all product packages including the regularly defined
zope2 packages and those without the Products namespace package.
"""
-
+ import Products
packages = {}
for x in dir(Products):
m = getattr(Products, x)
@@ -37,7 +40,7 @@
return packages
-class ProductDispatcher(Acquisition.Implicit):
+class ProductDispatcher(Implicit):
" "
# Allow access to factory dispatchers
__allow_access_to_unprotected_subobjects__=1
@@ -57,7 +60,7 @@
dispatcher=dispatcher_class(product, self.aq_parent, REQUEST)
return dispatcher.__of__(self)
-class FactoryDispatcher(Acquisition.Implicit):
+class FactoryDispatcher(Implicit):
"""Provide a namespace for product "methods"
"""
@@ -66,7 +69,7 @@
_owner=UnownableOwner
def __init__(self, product, dest, REQUEST=None):
- product = Acquisition.aq_base(product)
+ product = aq_base(product)
self._product=product
self._d=dest
if REQUEST is not None:
@@ -100,19 +103,19 @@
m=d[name]
w=getattr(m, '_permissionMapper', None)
if w is not None:
- m=aqwrap(m, Acquisition.aq_base(w), self)
+ m=aqwrap(m, aq_base(w), self)
return m
# Waaa
- m='Products.%s' % p.id
+ m = 'Products.%s' % p.id
if sys.modules.has_key(m) and sys.modules[m]._m.has_key(name):
return sys.modules[m]._m[name]
raise AttributeError, name
# Provide acquired indicators for critical OM methods:
- _setObject=_getOb=Acquisition.Acquired
+ _setObject = _getOb = Acquired
# Make sure factory methods are unowned:
_owner=UnownableOwner
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/ImageFile.py
===================================================================
--- Zope/trunk/lib/python/App/ImageFile.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/ImageFile.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -18,25 +18,23 @@
import stat
import time
-import Acquisition
-import Globals
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Explicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.Common import package_home
+from App.Common import rfc1123_date
from App.config import getConfiguration
-from Globals import package_home
-from Common import rfc1123_date
-from DateTime import DateTime
-
+from DateTime.DateTime import DateTime
from zope.contenttype import guess_content_type
-
from ZPublisher.Iterators import filestream_iterator
-class ImageFile(Acquisition.Explicit):
+class ImageFile(Explicit):
"""Image objects stored in external files."""
security = ClassSecurityInfo()
def __init__(self,path,_prefix=None):
+ import Globals
if _prefix is None:
_prefix=getConfiguration().softwarehome
elif type(_prefix) is not type(''):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/Management.py
===================================================================
--- Zope/trunk/lib/python/App/Management.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/Management.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,19 +15,22 @@
$Id$
"""
-import sys, ExtensionClass, urllib
-from Globals import DTMLFile, HTMLFile
-from Globals import InitializeClass
-from zExceptions import Redirect
+from cgi import escape
+import sys
+import urllib
+
+from zope.interface import implements
from AccessControl import getSecurityManager, Unauthorized
from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import view_management_screens
-from cgi import escape
-from zope.interface import implements
+import ExtensionClass
+from zExceptions import Redirect
-from interfaces import INavigation
+from App.class_init import default__class_init__ as InitializeClass
+from App.interfaces import INavigation
+from App.special_dtml import HTMLFile
+from App.special_dtml import DTMLFile
-
class Tabs(ExtensionClass.Base):
"""Mix-in provides management folder tab support."""
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/Permission.py
===================================================================
--- Zope/trunk/lib/python/App/Permission.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/Permission.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,29 +15,35 @@
$Id$'''
__version__='$Revision: 1.9 $'[11:-2]
-import OFS.SimpleItem, Acquisition, Globals, ExtensionClass, AccessControl.Role
-from AccessControl import ClassSecurityInfo, Permissions
+from AccessControl.Permissions import view_management_screens
+from AccessControl.Permissions import define_permissions
+from AccessControl.Role import RoleManager
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from ExtensionClass import Base
+from OFS.SimpleItem import Item
+from Persistence import Persistent
-view_management_screens = Permissions.view_management_screens
-define_permissions = Permissions.define_permissions
-
-
-class Permission(
- AccessControl.Role.RoleManager,
- Globals.Persistent, Acquisition.Implicit, OFS.SimpleItem.Item
- ):
- "Model Permission meta-data"
- meta_type='Zope Permission'
- icon='p_/Permission_icon'
+class Permission(RoleManager,
+ Persistent,
+ Implicit,
+ Item
+ ):
+ """Model Permission meta-data
+ """
+ meta_type = 'Zope Permission'
+ icon = 'p_/Permission_icon'
security = ClassSecurityInfo()
manage_options=(
(
{'label':'Edit', 'action':'manage_main',
- 'help':('OFSP','Zope-Permission_Edit.stx')},
+ 'help':('OFSP', 'Zope-Permission_Edit.stx')},
)
- +AccessControl.Role.RoleManager.manage_options
- +OFS.SimpleItem.Item.manage_options
+ + RoleManager.manage_options
+ + Item.manage_options
)
def __init__(self, id, title, name):
@@ -65,25 +71,25 @@
def _register(self):
# Register with the product folder
- product=self.aq_parent
+ product = self.aq_parent
product.aq_acquire('_manage_add_product_permission')(
product, self.name)
def _unregister(self):
# Unregister with the product folder
- product=self.aq_parent
+ product = self.aq_parent
product.aq_acquire('_manage_remove_product_permission')(
product, self.name)
security.declareProtected(view_management_screens, 'manage_main')
- manage_main=Globals.DTMLFile('dtml/editPermission',globals())
+ manage_main = DTMLFile('dtml/editPermission', globals())
- index_html=None
+ index_html = None
-Globals.InitializeClass(Permission)
+InitializeClass(Permission)
-class PermissionManager(ExtensionClass.Base):
+class PermissionManager(Base):
security = ClassSecurityInfo()
@@ -92,15 +98,16 @@
},
security.declareProtected(define_permissions, 'manage_addPermissionForm')
- manage_addPermissionForm=Globals.DTMLFile('dtml/addPermission',globals())
+ manage_addPermissionForm = DTMLFile('dtml/addPermission', globals())
security.declareProtected(define_permissions, 'manage_addPermission')
def manage_addPermission(
self, id, title, permission, REQUEST=None):
- ' '
+ """ Add a TTW permission.
+ """
i=Permission(id, title, permission)
- self._setObject(id,i)
+ self._setObject(id, i)
if REQUEST is not None:
- return self.manage_main(self,REQUEST,update_menu=1)
+ return self.manage_main(self, REQUEST, update_menu=1)
-Globals.InitializeClass(PermissionManager)
+InitializeClass(PermissionManager)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/PersistentExtra.py
===================================================================
--- Zope/trunk/lib/python/App/PersistentExtra.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/PersistentExtra.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,36 +15,30 @@
$Id$
"""
-import Globals
-from DateTime import DateTime
-from Persistence import Persistent
-from zope.interface import classImplements
-from zope.interface import implements
-
-from class_init import default__class_init__
-from interfaces import IPersistentExtra
-
-
-Persistent.__class_init__ = default__class_init__
-
class PersistentUtil:
- implements(IPersistentExtra)
+ def _datetime(self, x=None):
+ from DateTime.DateTime import DateTime
+ if x is None:
+ return DateTime()
+ return DateTime(x)
def bobobase_modification_time(self):
jar=self._p_jar
oid=self._p_oid
- if jar is None or oid is None: return DateTime()
+ if jar is None or oid is None:
+ return self._datetime()
try:
- t=self._p_mtime
- if t is None: return DateTime()
- except: t=0
- return DateTime(t)
+ t = self._p_mtime
+ except:
+ t = 0
+ return self._datetime(t)
def locked_in_version(self):
"""Was the object modified in any version?
"""
+ import Globals
jar=self._p_jar
oid=self._p_oid
if jar is None or oid is None: return None
@@ -80,8 +74,24 @@
except: return 0
return 1
-for k, v in PersistentUtil.__dict__.items():
- if k[0] != '_':
- setattr(Persistent, k, v)
-classImplements(Persistent, IPersistentExtra)
+_patched = False
+
+def patchPersistent():
+ global _patched
+ if _patched:
+ return
+
+ _patched = True
+
+ from zope.interface import classImplements
+ from Persistence import Persistent
+ from App.class_init import default__class_init__
+ from App.interfaces import IPersistentExtra
+ Persistent.__class_init__ = default__class_init__
+
+ for k, v in PersistentUtil.__dict__.items():
+ if k[0] != '_':
+ setattr(Persistent, k, v)
+
+ classImplements(Persistent, IPersistentExtra)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/Product.py
===================================================================
--- Zope/trunk/lib/python/App/Product.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/Product.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -34,25 +34,26 @@
# on restart if there is still a product directory.
-import os, re, zlib, marshal, cPickle
from cgi import escape
+import cPickle
+import marshal
+import os
+import re
from urllib import quote
+import zlib
import transaction
-import Globals, OFS.Folder, OFS.SimpleItem, Acquisition, Products
-from Globals import InitializeClass
-import AccessControl.Owned
+from AccessControl.Owned import UnownableOwner
+from AccessControl.Permissions import manage_zclasses
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.unauthorized import Unauthorized
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
from OFS.Folder import Folder
-from HelpSys.HelpSys import ProductHelp
-from AccessControl import Unauthorized
-from AccessControl import ClassSecurityInfo
-from AccessControl.Permissions import manage_zclasses
-from Factory import Factory
-from Permission import PermissionManager
-import RefreshFuncs
-from App.config import getConfiguration
+from App.Factory import Factory
+from App.Permission import PermissionManager
# BBB: ZClasses are deprecated but we don't want the warning to appear here
import warnings
@@ -69,23 +70,25 @@
class ProductFolder(Folder):
"Manage a collection of Products"
- id ='Products'
- name=title='Product Management'
- meta_type ='Product Management'
- icon='p_/ProductFolder_icon'
+ id = 'Products'
+ name = title = 'Product Management'
+ meta_type = 'Product Management'
+ icon = 'p_/ProductFolder_icon'
all_meta_types={'name': 'Product', 'action': 'manage_addProductForm',
'permission': manage_zclasses},
- meta_types=all_meta_types
+ meta_types = all_meta_types
# This prevents subobjects from being owned!
- _owner=AccessControl.Owned.UnownableOwner
+ _owner = UnownableOwner
- def _product(self, name): return getattr(self, name)
+ def _product(self, name):
+ return getattr(self, name)
- manage_addProductForm=Globals.DTMLFile('dtml/addProduct',globals())
+ manage_addProductForm = DTMLFile('dtml/addProduct', globals())
def manage_addProduct(self, id, title, REQUEST=None):
- ' '
+ """ Create a product.
+ """
i=Product(id, title)
self._setObject(id,i)
if REQUEST is not None:
@@ -132,7 +135,8 @@
meta_types=(
- ZClasses.meta_types+PermissionManager.meta_types+
+ ZClasses.meta_types +
+ PermissionManager.meta_types +
(
{
'name': Factory.meta_type,
@@ -146,23 +150,23 @@
manage_subclassableClassNames=ZClasses.methods[
'manage_subclassableClassNames']
- manage_options=(
+ manage_options = (
(Folder.manage_options[0],) +
tuple(Folder.manage_options[2:])
)
- _properties=Folder._properties+(
+ _properties = Folder._properties+(
{'id':'version', 'type': 'string'},
)
_reserved_names=('Help',)
- manage_addPrincipiaFactoryForm=Globals.DTMLFile(
- 'dtml/addFactory',globals())
+ manage_addPrincipiaFactoryForm = DTMLFile('dtml/addFactory', globals())
def manage_addPrincipiaFactory(
self, id, title, object_type, initial, permission=None, REQUEST=None):
- ' '
- i=Factory(id, title, object_type, initial, permission)
+ """ Add a ZClass factory
+ """
+ i = Factory(id, title, object_type, initial, permission)
self._setObject(id,i)
factory = self._getOb(id)
factory.initializePermission()
@@ -173,14 +177,6 @@
self.id=id
self.title=title
- # Workaround for unknown problem with help system and PluginIndexes product
- # NEEDS to be fixed for 2.4 ! (ajung)
-
- try:
- self._setObject('Help', ProductHelp('Help', id))
- except:
- pass
-
security.declarePublic('Destination')
def Destination(self):
"Return the destination for factory output"
@@ -192,8 +188,8 @@
return self.REQUEST['BASE4']
- manage_traceback=Globals.DTMLFile('dtml/traceback',globals())
- manage_readme=Globals.DTMLFile('dtml/readme',globals())
+ manage_traceback = DTMLFile('dtml/traceback', globals())
+ manage_readme = DTMLFile('dtml/readme', globals())
def manage_get_product_readme__(self):
for name in ('README.txt', 'README.TXT', 'readme.txt'):
path = os.path.join(self.home, name)
@@ -208,21 +204,19 @@
return self.id
def getProductHelp(self):
+ """Returns the ProductHelp object associated with the Product.
"""
- Returns the ProductHelp object associated
- with the Product.
- """
- if not hasattr(self, 'Help'):
- self._setObject('Help', ProductHelp('Help', self.id))
- return self.Help
+ from HelpSys.HelpSys import ProductHelp
+ return ProductHelp('Help', self.id).__of__(self)
#
# Product refresh
#
- _refresh_dtml = Globals.DTMLFile('dtml/refresh', globals())
+ _refresh_dtml = DTMLFile('dtml/refresh', globals())
def _readRefreshTxt(self, pid=None):
+ import Products
refresh_txt = None
if pid is None:
pid = self.id
@@ -246,11 +240,16 @@
return refresh_txt
def manage_refresh(self, REQUEST, manage_tabs_message=None):
- '''
- Displays the refresh management screen.
- '''
+ """Displays the refresh management screen.
+ """
+ import Globals
+ from App.RefreshFuncs import getLastRefreshException
+ from App.RefreshFuncs import isAutoRefreshEnabled
+ from App.RefreshFuncs import getDependentProducts
+ from App.RefreshFuncs import listRefreshableModules
+ from App.RefreshFuncs import listAutoRefreshableModules
error_type = error_value = error_tb = None
- exc = RefreshFuncs.getLastRefreshException(self.id)
+ exc = getLastRefreshException(self.id)
if exc is not None:
error_type, error_value, error_tb = exc
exc = None
@@ -258,11 +257,11 @@
refresh_txt = self._readRefreshTxt()
# Read the persistent refresh information.
- auto = RefreshFuncs.isAutoRefreshEnabled(self._p_jar, self.id)
- deps = RefreshFuncs.getDependentProducts(self._p_jar, self.id)
+ auto = isAutoRefreshEnabled(self._p_jar, self.id)
+ deps = getDependentProducts(self._p_jar, self.id)
# List all product modules.
- mods = RefreshFuncs.listRefreshableModules(self.id)
+ mods = listRefreshableModules(self.id)
loaded_modules = []
prefix = 'Products.%s' % self.id
prefixdot = prefix + '.'
@@ -274,7 +273,7 @@
name = '__init__'
loaded_modules.append(name)
- all_auto = RefreshFuncs.listAutoRefreshableProducts(self._p_jar)
+ all_auto = listAutoRefreshableProducts(self._p_jar)
for pid in all_auto:
# Ignore products that don't have a refresh.txt.
if self._readRefreshTxt(pid) is None:
@@ -298,13 +297,13 @@
management_view='Refresh')
def manage_performRefresh(self, REQUEST=None):
- '''
- Attempts to perform a refresh operation.
- '''
+ """ Attempts to perform a refresh operation.
+ """
+ from App.RefreshFuncs import performFullRefresh
if self._readRefreshTxt() is None:
raise Unauthorized, 'refresh.txt not found'
message = None
- if RefreshFuncs.performFullRefresh(self._p_jar, self.id):
+ if performFullRefresh(self._p_jar, self.id):
from ZODB import Connection
Connection.resetCaches() # Clears cache in future connections.
message = 'Product refreshed.'
@@ -314,12 +313,12 @@
return self.manage_refresh(REQUEST, manage_tabs_message=message)
def manage_enableAutoRefresh(self, enable=0, REQUEST=None):
- '''
- Changes the auto refresh flag for this product.
- '''
+ """ Changes the auto refresh flag for this product.
+ """
+ from App.RefreshFuncs import enableAutoRefresh
if self._readRefreshTxt() is None:
raise Unauthorized, 'refresh.txt not created'
- RefreshFuncs.enableAutoRefresh(self._p_jar, self.id, enable)
+ enableAutoRefresh(self._p_jar, self.id, enable)
if enable:
message = 'Enabled auto refresh.'
else:
@@ -328,12 +327,12 @@
return self.manage_refresh(REQUEST, manage_tabs_message=message)
def manage_selectDependentProducts(self, selections=(), REQUEST=None):
- '''
- Selects which products to refresh simultaneously.
- '''
+ """ Selects which products to refresh simultaneously.
+ """
+ from App.RefreshFuncs import setDependentProducts
if self._readRefreshTxt() is None:
raise Unauthorized, 'refresh.txt not created'
- RefreshFuncs.setDependentProducts(self._p_jar, self.id, selections)
+ setDependentProducts(self._p_jar, self.id, selections)
if REQUEST is not None:
return self.manage_refresh(REQUEST)
@@ -401,7 +400,8 @@
def initializeProduct(productp, name, home, app):
# Initialize a levered product
- products=app.Control_Panel.Products
+ import Globals
+ products = app.Control_Panel.Products
fver = ''
if hasattr(productp, '__import_error__'): ie=productp.__import_error__
@@ -485,7 +485,7 @@
return product
# Give the ZClass fixup code in Application
- Globals.__disk_product_installed__=1
+ Globals.__disk_product_installed__ = 1
return product
def ihasattr(o, name):
@@ -493,5 +493,6 @@
def doInstall():
+ from App.config import getConfiguration
return getConfiguration().enable_product_installation
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/ProductContext.py
===================================================================
--- Zope/trunk/lib/python/App/ProductContext.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/ProductContext.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,23 +15,31 @@
$Id$
"""
+from logging import getLogger
+import os
+import re
import stat
-import os.path, re
-from logging import getLogger
+from AccessControl.Permission import registerPermissions
from AccessControl.PermissionRole import PermissionRole
-import Globals, os, OFS.ObjectManager, OFS.misc_, Products
-import AccessControl.Permission
+from App.Common import package_home
+from App.ImageFile import ImageFile
from App.Product import doInstall
-from HelpSys import HelpTopic, APIHelpTopic
+from DateTime.DateTime import DateTime
+from HelpSys import APIHelpTopic
+from HelpSys import HelpTopic
from HelpSys.HelpSys import ProductHelp
-from FactoryDispatcher import FactoryDispatcher
+from OFS.misc_ import Misc_
+from OFS.misc_ import misc_
+from OFS.ObjectManager import ObjectManager
-from DateTime import DateTime
from zope.interface import implementedBy
+from App.FactoryDispatcher import FactoryDispatcher
import ZClasses # to enable 'PC.registerBaseClass()'
+# Waaaa
+import Products
if not hasattr(Products, 'meta_types'):
Products.meta_types=()
if not hasattr(Products, 'meta_classes'):
@@ -120,11 +128,9 @@
for p in permissions:
if isinstance(p, tuple):
p, default= p
- AccessControl.Permission.registerPermissions(
- ((p, (), default),))
+ registerPermissions(((p, (), default),))
else:
- AccessControl.Permission.registerPermissions(
- ((p, ()),))
+ registerPermissions(((p, ()),))
############################################################
# Constructor permission setup
@@ -137,11 +143,10 @@
default = ('Manager',)
pr=PermissionRole(permission,default)
- AccessControl.Permission.registerPermissions(
- ((permission, (), default),))
+ registerPermissions(((permission, (), default),))
############################################################
- OM=OFS.ObjectManager.ObjectManager
+ OM = ObjectManager
for method in legacy:
if isinstance(method, tuple):
@@ -183,7 +188,7 @@
else:
interfaces = tuple(implementedBy(instance_class))
- Products.meta_types=Products.meta_types+(
+ Products.meta_types = Products.meta_types + (
{ 'name': meta_type or instance_class.meta_type,
# 'action': The action in the add drop down in the ZMI. This is
# currently also required by the _verifyObjectPaste
@@ -217,12 +222,12 @@
m[name+'__roles__']=pr
if icon:
- name=os.path.split(icon)[1]
- icon=Globals.ImageFile(icon, self.__pack.__dict__)
+ name = os.path.split(icon)[1]
+ icon = ImageFile(icon, self.__pack.__dict__)
icon.__roles__=None
- if not hasattr(OFS.misc_.misc_, pid):
- setattr(OFS.misc_.misc_, pid, OFS.misc_.Misc_(pid, {}))
- getattr(OFS.misc_.misc_, pid)[name]=icon
+ if not hasattr(misc_, pid):
+ setattr(misc_, pid, Misc_(pid, {}))
+ getattr(misc_, pid)[name]=icon
def registerZClass(self, Z, meta_type=None):
#
@@ -303,7 +308,7 @@
return
help=self.getProductHelp()
- path=os.path.join(Globals.package_home(self.__pack.__dict__),
+ path=os.path.join(package_home(self.__pack.__dict__),
directory)
# If help directory does not exist, log a warning and return.
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/Undo.py
===================================================================
--- Zope/trunk/lib/python/App/Undo.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/Undo.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,18 +15,21 @@
$Id$
"""
-from Acquisition import aq_base, aq_parent, aq_inner
-from Globals import InitializeClass
+from Acquisition import aq_base
+from Acquisition import aq_inner
+from Acquisition import aq_parent
from AccessControl import getSecurityManager
from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import undo_changes
-from DateTime import DateTime
-import Globals, ExtensionClass
+from DateTime.DateTime import DateTime
+import ExtensionClass
+import transaction
from ZopeUndo.Prefix import Prefix
-import transaction
from zope.interface import implements
-from interfaces import IUndoSupport
+from App.class_init import default__class_init__ as InitializeClass
+from App.interfaces import IUndoSupport
+from App.special_dtml import DTMLFile
class UndoSupport(ExtensionClass.Base):
@@ -41,7 +44,7 @@
)
security.declareProtected(undo_changes, 'manage_UndoForm')
- manage_UndoForm=Globals.DTMLFile(
+ manage_UndoForm = DTMLFile(
'dtml/undo',
globals(),
PrincipiaUndoBatchSize=20,
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/class_init.py
===================================================================
--- Zope/trunk/lib/python/App/class_init.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/class_init.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -12,8 +12,6 @@
##############################################################################
import logging
-from AccessControl.PermissionRole import PermissionRole
-import AccessControl.Permission
class ApplicationDefaultPermissions:
_View_Permission='Manager', 'Anonymous'
@@ -21,6 +19,8 @@
def default__class_init__(self):
+ from AccessControl.Permission import registerPermissions
+ from AccessControl.PermissionRole import PermissionRole
dict=self.__dict__
have=dict.has_key
ft=type(default__class_init__)
@@ -66,7 +66,7 @@
break
if self.__dict__.has_key('__ac_permissions__'):
- AccessControl.Permission.registerPermissions(self.__ac_permissions__)
+ registerPermissions(self.__ac_permissions__)
for acp in self.__ac_permissions__:
pname, mnames = acp[:2]
if len(acp) > 2:
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/testPersistentExtra.py
===================================================================
--- Zope/trunk/lib/python/App/tests/testPersistentExtra.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/testPersistentExtra.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -1,32 +1,20 @@
import unittest
-import Testing
-import Zope2
-Zope2.startup()
-class TestPersistentUtil(unittest.TestCase):
-
- def test_z3interfaces(self):
- from App.interfaces import IPersistentExtra
- from App.PersistentExtra import PersistentUtil
- from zope.interface.verify import verifyClass
-
- verifyClass(IPersistentExtra, PersistentUtil)
-
-
class TestPersistent(unittest.TestCase):
def test_z3interfaces(self):
from App.interfaces import IPersistentExtra
from Persistence import Persistent
from zope.interface.verify import verifyClass
+ from App.PersistentExtra import patchPersistent
+ patchPersistent()
verifyClass(IPersistentExtra, Persistent)
def test_suite():
return unittest.TestSuite((
- unittest.makeSuite(TestPersistentUtil),
unittest.makeSuite(TestPersistent),
))
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_cachemanager.py
===================================================================
--- Zope/trunk/lib/python/App/tests/test_cachemanager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_cachemanager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,22 +15,8 @@
$Id$
"""
-
import unittest
-import ZODB
-
-from App.CacheManager import CacheManager
-
-
-class TestCacheManager(CacheManager):
- # Derived CacheManager that fakes enough of the DatabaseManager to
- # make it possible to test at least some parts of the CacheManager.
-
- def __init__(self, connection):
- self._p_jar = connection
-
-
class DummyConnection:
def __init__(self, db, version=None):
@@ -62,23 +48,35 @@
class CacheManagerTestCase(unittest.TestCase):
- def setUp(self):
- self.db = DummyDB(42, 24)
- self.connection = DummyConnection(self.db)
- self.manager = TestCacheManager(self.connection)
+ def _getManagerClass(self):
+ from App.CacheManager import CacheManager
+ class TestCacheManager(CacheManager):
+ # Derived CacheManager that fakes enough of the DatabaseManager to
+ # make it possible to test at least some parts of the CacheManager.
+ def __init__(self, connection):
+ self._p_jar = connection
+ return TestCacheManager
+ def _makeThem(self):
+ manager = self._getManagerClass()(connection)
+ return db, connection, manager
+
def test_cache_size(self):
- self.assertEqual(self.manager.cache_size(), 42)
- self.db._set_sizes(12, 2)
- self.assertEqual(self.manager.cache_size(), 12)
+ db = DummyDB(42, 24)
+ connection = DummyConnection(db)
+ manager = self._getManagerClass()(connection)
+ self.assertEqual(manager.cache_size(), 42)
+ db._set_sizes(12, 2)
+ self.assertEqual(manager.cache_size(), 12)
def test_version_cache_size(self):
- self.connection = DummyConnection(self.db, "my version")
- self.manager = TestCacheManager(self.connection)
+ db = DummyDB(42, 24)
+ connection = DummyConnection(db, "my version")
+ manager = self._getManagerClass()(connection)
# perform test
- self.assertEqual(self.manager.cache_size(), 24)
- self.db._set_sizes(12, 2)
- self.assertEqual(self.manager.cache_size(), 2)
+ self.assertEqual(manager.cache_size(), 24)
+ db._set_sizes(12, 2)
+ self.assertEqual(manager.cache_size(), 2)
def test_suite():
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_class_init.py
===================================================================
--- Zope/trunk/lib/python/App/tests/test_class_init.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_class_init.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,16 +14,14 @@
"""Tests class initialization.
"""
-import ExtensionClass
-from App.class_init import default__class_init__ as InitializeClass
-
-
def test_InitializeClass():
"""Test that InitializeClass (default__class_init__)
works in specific corner cases.
Check when the class has an ExtensionClass as attribute.
+ >>> import ExtensionClass
+ >>> from App.class_init import default__class_init__ as InitializeClass
>>> class AnotherClass(ExtensionClass.Base):
... _need__name__ = 1
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_setConfiguration.py
===================================================================
--- Zope/trunk/lib/python/App/tests/test_setConfiguration.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_setConfiguration.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -13,21 +13,19 @@
##############################################################################
"""Tests for App.config.setConfiguration()
"""
+import unittest
-import os, sys, unittest
-
import Testing
-import Zope2
-Zope2.startup()
+#import Zope2
+#Zope2.startup()
-import App.config
-import App.FindHomes
-import Globals
-import __builtin__
+from Testing.ZopeTestCase.layer import ZopeLite
class SetConfigTests(unittest.TestCase):
+ layer = ZopeLite
+
def setUp(self):
# Save away everything as we need to restore it later on
self.clienthome = self.getconfig('clienthome')
@@ -44,16 +42,22 @@
debug_mode=self.debug_mode)
def getconfig(self, key):
+ import App.config
config = App.config.getConfiguration()
return getattr(config, key, None)
def setconfig(self, **kw):
+ import App.config
config = App.config.getConfiguration()
for key, value in kw.items():
setattr(config, key, value)
App.config.setConfiguration(config)
def testClientHomeLegacySources(self):
+ import os
+ import App.FindHomes
+ import Globals
+ import __builtin__
self.setconfig(clienthome='foo')
self.assertEqual(os.environ.get('CLIENT_HOME'), 'foo')
self.assertEqual(App.FindHomes.CLIENT_HOME, 'foo')
@@ -61,6 +65,10 @@
self.assertEqual(Globals.data_dir, 'foo')
def testInstanceHomeLegacySources(self):
+ import os
+ import App.FindHomes
+ import Globals
+ import __builtin__
self.setconfig(instancehome='foo')
self.assertEqual(os.environ.get('INSTANCE_HOME'), 'foo')
self.assertEqual(App.FindHomes.INSTANCE_HOME, 'foo')
@@ -68,6 +76,10 @@
self.assertEqual(Globals.INSTANCE_HOME, 'foo')
def testSoftwareHomeLegacySources(self):
+ import os
+ import App.FindHomes
+ import Globals
+ import __builtin__
self.setconfig(softwarehome='foo')
self.assertEqual(os.environ.get('SOFTWARE_HOME'), 'foo')
self.assertEqual(App.FindHomes.SOFTWARE_HOME, 'foo')
@@ -75,6 +87,10 @@
self.assertEqual(Globals.SOFTWARE_HOME, 'foo')
def testZopeHomeLegacySources(self):
+ import os
+ import App.FindHomes
+ import Globals
+ import __builtin__
self.setconfig(zopehome='foo')
self.assertEqual(os.environ.get('ZOPE_HOME'), 'foo')
self.assertEqual(App.FindHomes.ZOPE_HOME, 'foo')
@@ -82,6 +98,7 @@
self.assertEqual(Globals.ZOPE_HOME, 'foo')
def testDebugModeLegacySources(self):
+ import Globals
self.setconfig(debug_mode=True)
self.assertEqual(Globals.DevelopmentMode, True)
self.setconfig(debug_mode=False)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_version_txt.py
===================================================================
--- Zope/trunk/lib/python/App/tests/test_version_txt.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/tests/test_version_txt.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,41 +15,48 @@
$Id$
"""
-import os
import unittest
-import Zope2
-import App.version_txt
class VersionTextTestCase(unittest.TestCase):
def setUp(self):
- self.fn = os.path.join(os.path.dirname(Zope2.__file__), "version.txt")
- App.version_txt._test_reset()
+ self._resetModuleGlobals()
def tearDown(self):
- try:
- os.unlink(self.fn)
- except OSError:
- pass
+ import os
+ from App.version_txt import _version_file
+ if _version_file is not None:
+ os.unlink(_version_file)
+ self._resetModuleGlobals()
+ def _resetModuleGlobals(self):
+ from App import version_txt
+ version_txt._version_file = None
+ version_txt._version_string = None
+ version_txt._zope_version = None
+
def writeVersion(self, s):
- f = open(self.fn, 'w')
- f.write(s)
- f.close()
+ import os
+ import tempfile
+ from App import version_txt
+ assert version_txt._version_file is None
+ f, version_txt._version_file = tempfile.mkstemp()
+ os.write(f, s)
+ os.close(f)
def test_without_version_txt(self):
- self.assertEqual(App.version_txt.getZopeVersion(),
- (-1, -1, -1, '', -1))
+ from App.version_txt import getZopeVersion
+ self.assertEqual(getZopeVersion(), (-1, -1, -1, '', -1))
def test_with_version_txt_final(self):
+ from App.version_txt import getZopeVersion
self.writeVersion("Zope 2.6.1 (source release, python 2.1, linux2)")
- self.assertEqual(App.version_txt.getZopeVersion(),
- (2, 6, 1, '', -1))
+ self.assertEqual(getZopeVersion(), (2, 6, 1, '', -1))
def test_with_version_txt_beta(self):
+ from App.version_txt import getZopeVersion
self.writeVersion("Zope 2.6.1b2 (source release, python 2.1, linux2)")
- self.assertEqual(App.version_txt.getZopeVersion(),
- (2, 6, 1, 'b', 2))
+ self.assertEqual(getZopeVersion(), (2, 6, 1, 'b', 2))
def test_suite():
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/App/version_txt.py
===================================================================
--- Zope/trunk/lib/python/App/version_txt.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/App/version_txt.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,24 +14,26 @@
$id$
"""
-import os, sys, re
-import Zope2
+import os
+import re
+import sys
+_version_file = None
_version_string = None
_zope_version = None
-def _test_reset():
- # Needed for testing.
- global _version_string, _zope_version
- _version_string = None
- _zope_version = None
+def _get_filename():
+ import Zope2
+ if _version_file is not None:
+ return _version_file
+ return os.path.join(os.path.dirname(Zope2.__file__), 'version.txt')
def _prep_version_data():
global _version_string, _zope_version
if _version_string is None:
v = sys.version_info
pyver = "python %d.%d.%d, %s" % (v[0], v[1], v[2], sys.platform)
- fn = os.path.join(os.path.dirname(Zope2.__file__), 'version.txt')
+ fn = _get_filename()
expr = re.compile(
r'(?P<product>[A-Za-z0-9]+) +(?P<major>[0-9]+)'
'\.(?P<minor>[0-9]+)\.(?P<micro>[0-9]+)'
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Globals/__init__.py
===================================================================
--- Zope/trunk/lib/python/Globals/__init__.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Globals/__init__.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -10,44 +10,20 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
+"""Shared global data
-"""Global definitions"""
-
+o N.B.: DO NOT IMPORT ANYTHING HERE! This module is just for shared data!
+"""
__version__='$Revision: 1.56 $'[11:-2]
+DevelopmentMode = False
+
# Global constants: __replaceable__ flags:
NOT_REPLACEABLE = 0
REPLACEABLE = 1
UNIQUE = 2
-import Acquisition, ComputedAttribute, App.PersistentExtra, os
-import TreeDisplay
-
-from App.Common import package_home, attrget, Dictionary
-from App.config import getConfiguration as _getConfiguration
-from Persistence import Persistent, PersistentMapping
-from App.class_init import default__class_init__, ApplicationDefaultPermissions
-
-# Nicer alias for class initializer.
-InitializeClass = default__class_init__
-
-from App.special_dtml import HTML, HTMLFile, DTMLFile
-from App.Dialogs import MessageDialog
-from App.ImageFile import ImageFile
-
VersionNameName='Zope-Version'
-_cfg = _getConfiguration()
-data_dir = _cfg.clienthome
-
-# backward compatibility
-INSTANCE_HOME = _cfg.instancehome
-SOFTWARE_HOME = _cfg.softwarehome
-ZOPE_HOME = _cfg.zopehome
-
-opened=[]
-
-DevelopmentMode=_cfg.debug_mode
-
-del _cfg, _getConfiguration
-
+# XXX ZODB stashes the main database object here
+opened = []
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/HelpSys/APIHelpTopic.py
===================================================================
--- Zope/trunk/lib/python/HelpSys/APIHelpTopic.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/HelpSys/APIHelpTopic.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,16 +17,16 @@
import types
-from AccessControl import ClassSecurityInfo
-from Globals import DTMLFile
-from Globals import InitializeClass
-from Globals import Persistent
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from Persistence import Persistent
-import HelpTopic
+from HelpTopic import HelpTopic # XXX relative to avoid cycle
_ignore_objects = {}
-class APIHelpTopic(HelpTopic.HelpTopic):
+class APIHelpTopic(HelpTopic):
""" Provides API documentation.
"""
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/HelpSys/HelpSys.py
===================================================================
--- Zope/trunk/lib/python/HelpSys/HelpSys.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/HelpSys/HelpSys.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -10,23 +10,23 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
+from cgi import escape
-import Acquisition
-from OFS.SimpleItem import Item
-from OFS.ObjectManager import ObjectManager
-from Globals import Persistent, DTMLFile, HTML
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import access_contents_information
from AccessControl.Permissions import add_documents_images_and_files
from AccessControl.Permissions import view as View
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from App.special_dtml import HTML
+from OFS.ObjectManager import ObjectManager
+from OFS.SimpleItem import Item
+from Persistence import Persistent
from Products.ZCatalog.ZCatalog import ZCatalog
from Products.ZCatalog.Lazy import LazyCat
-from cgi import escape
-import Products
-import HelpTopic
-class HelpSys(Acquisition.Implicit, ObjectManager, Item, Persistent):
+class HelpSys(Implicit, ObjectManager, Item, Persistent):
"""
Zope Help System
@@ -48,6 +48,7 @@
security.declareProtected(access_contents_information, 'helpValues')
def helpValues(self, spec=None):
"ProductHelp objects of all Products that have help"
+ import Products
hv=[]
for product in self.Control_Panel.Products.objectValues():
productHelp=product.getProductHelp()
@@ -192,7 +193,7 @@
return self.id
-class ProductHelp(Acquisition.Implicit, ObjectManager, Item, Persistent):
+class ProductHelp(Implicit, ObjectManager, Item, Persistent):
"""
Manages a collection of Help Topics for a given Product.
@@ -240,8 +241,9 @@
security.declareProtected(add_documents_images_and_files, 'addTopic')
def addTopic(self, id, title, REQUEST=None):
"Add a Help Topic"
- topic=HelpTopic.DTMLDocumentTopic(
- HelpTopic.default_topic_content, __name__=id)
+ from HelpSys.HelpTopic import DTMLDocumentTopic
+ from HelpSys.HelpTopic import default_topic_content
+ topic = DTMLDocumentTopic(default_topic_content, __name__=id)
topic.title=title
self._setObject(id, topic)
if REQUEST is not None:
@@ -297,6 +299,7 @@
return topics
def all_meta_types(self):
+ import Products
f=lambda x: x['name'] in ('Image', 'File')
return filter(f, Products.meta_types) + self.meta_types
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/HelpSys/HelpTopic.py
===================================================================
--- Zope/trunk/lib/python/HelpSys/HelpTopic.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/HelpSys/HelpTopic.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -10,19 +10,21 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
+import os
-import Acquisition
-from ComputedAttribute import ComputedAttribute
-from OFS.SimpleItem import Item
-from Globals import Persistent, HTML, DTMLFile, ImageFile
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import access_contents_information
from AccessControl.Permissions import view as View
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.ImageFile import ImageFile
+from App.special_dtml import DTMLFile
+from App.special_dtml import HTML
+from ComputedAttribute import ComputedAttribute
from OFS.DTMLDocument import DTMLDocument
from OFS.PropertyManager import PropertyManager
-import os.path
-import Globals
+from OFS.SimpleItem import Item
+from Persistence import Persistent
class HelpTopicBase:
"Mix-in Help Topic support class"
@@ -110,7 +112,7 @@
return c
-class HelpTopic(Acquisition.Implicit, HelpTopicBase, Item, PropertyManager, Persistent):
+class HelpTopic(Implicit, HelpTopicBase, Item, PropertyManager, Persistent):
"""
Abstract base class for Help Topics
"""
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Application.py
===================================================================
--- Zope/trunk/lib/python/OFS/Application.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Application.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -21,18 +21,21 @@
from StringIO import StringIO
from warnings import warn
-import Globals, Products, App.Product, App.ProductRegistry
+import Products
+import App.Product
+import App.ProductRegistry
import transaction
-from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from AccessControl.User import UserFolder
from Acquisition import aq_base
from App.ApplicationManager import ApplicationManager
+from App.class_init import default__class_init__ as InitializeClass
+from App.class_init import ApplicationDefaultPermissions
from App.config import getConfiguration
from App.Product import doInstall
-from App.ProductContext import ProductContext
from DateTime import DateTime
from HelpSys.HelpSys import HelpSys
+from Persistence import Persistent
from webdav.NullResource import NullResource
from zExceptions import Redirect as RedirectException, Forbidden
@@ -47,24 +50,26 @@
LOG = getLogger('Application')
-class Application(Globals.ApplicationDefaultPermissions,
- ZDOM.Root, Folder.Folder,
- App.ProductRegistry.ProductRegistry, FindSupport):
-
+class Application(ApplicationDefaultPermissions,
+ ZDOM.Root,
+ Folder.Folder,
+ App.ProductRegistry.ProductRegistry,
+ FindSupport,
+ ):
"""Top-level system object"""
implements(IApplication)
security = ClassSecurityInfo()
- title ='Zope'
- __defined_roles__=('Manager','Anonymous','Owner')
- web__form__method='GET'
- isTopLevelPrincipiaApplicationObject=1
- _isBeingUsedAsAMethod_=0
+ title = 'Zope'
+ __defined_roles__ = ('Manager','Anonymous','Owner')
+ web__form__method = 'GET'
+ isTopLevelPrincipiaApplicationObject = 1
+ _isBeingUsedAsAMethod_ = 0
# Create the help system object
- HelpSys=HelpSys('HelpSys')
+ HelpSys = HelpSys('HelpSys')
p_=misc_.p_
misc_=misc_.misc_
@@ -78,7 +83,7 @@
# UserFolder is deleted. This is necessary to allow people
# to replace the top-level UserFolder object.
- __allow_groups__=UserFolder()
+ __allow_groups__ = UserFolder()
# Set the universal default method to index_html
_object_manager_browser_default_id = 'index_html'
@@ -87,19 +92,21 @@
def __init__(self):
# Initialize users
- uf=UserFolder()
- self.__allow_groups__=uf
+ uf = UserFolder()
+ self.__allow_groups__ = uf
self._setObject('acl_users', uf)
# Initialize control panel
- cpl=ApplicationManager()
+ cpl = ApplicationManager()
cpl._init()
self._setObject('Control_Panel', cpl)
transaction.get().note("Created Zope Application")
def id(self):
- try: return self.REQUEST['SCRIPT_NAME'][1:]
- except: return self.title
+ try:
+ return self.REQUEST['SCRIPT_NAME'][1:]
+ except:
+ return self.title
def title_and_id(self):
return self.title
@@ -120,17 +127,24 @@
def __bobo_traverse__(self, REQUEST, name=None):
- try: return getattr(self, name)
- except AttributeError: pass
- try: return self[name]
- except KeyError: pass
- method=REQUEST.get('REQUEST_METHOD', 'GET')
+ try:
+ return getattr(self, name)
+ except AttributeError:
+ pass
+
+ try:
+ return self[name]
+ except KeyError:
+ pass
+
+ method = REQUEST.get('REQUEST_METHOD', 'GET')
if not method in ('GET', 'POST'):
return NullResource(self, name, REQUEST).__of__(self)
# Waaa. unrestrictedTraverse calls us with a fake REQUEST.
# There is proabably a better fix for this.
- try: REQUEST.RESPONSE.notFoundError("%s\n%s" % (name, method))
+ try:
+ REQUEST.RESPONSE.notFoundError("%s\n%s" % (name, method))
except AttributeError:
raise KeyError, name
@@ -286,7 +300,7 @@
InitializeClass(Application)
-class Expired(Globals.Persistent):
+class Expired(Persistent):
icon='p_/broken'
@@ -345,7 +359,7 @@
# Ensure that Control Panel exists.
if not hasattr(app, 'Control_Panel'):
- cpl=ApplicationManager()
+ cpl = ApplicationManager()
cpl._init()
app._setObject('Control_Panel', cpl)
self.commit('Added Control_Panel')
@@ -544,6 +558,7 @@
self.commit('Added virtual_hosting')
def check_zglobals(self):
+ import Globals
if not doInstall():
return
@@ -615,7 +630,7 @@
meta_types=[]
done={}
- debug_mode = App.config.getConfiguration().debug_mode
+ debug_mode = getConfiguration().debug_mode
transaction.get().note('Prior to product installs')
transaction.commit()
@@ -673,7 +688,7 @@
done={}
products = get_products()
- debug_mode = App.config.getConfiguration().debug_mode
+ debug_mode = getConfiguration().debug_mode
for priority, product_name, index, product_dir in products:
if done.has_key(product_name):
@@ -739,6 +754,7 @@
def install_product(app, product_dir, product_name, meta_types,
folder_permissions, raise_exc=0, log_exc=1):
+ from App.ProductContext import ProductContext
path_join=os.path.join
isdir=os.path.isdir
exists=os.path.exists
@@ -846,6 +862,7 @@
def install_package(app, module, init_func, raise_exc=False, log_exc=True):
"""Installs a Python package like a product."""
+ from App.ProductContext import ProductContext
try:
product = App.Product.initializeProduct(module,
module.__name__,
@@ -878,13 +895,16 @@
return
# Install the replaceable standard objects
+ from App.Common import package_home
+ from App.special_dtml import DTMLFile
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
- std_dir = os.path.join(Globals.package_home(globals()), 'standard')
+
+ std_dir = os.path.join(package_home(globals()), 'standard')
wrote = 0
for fn in os.listdir(std_dir):
base, ext = os.path.splitext(fn)
if ext == '.dtml':
- ob = Globals.DTMLFile(base, std_dir)
+ ob = DTMLFile(base, std_dir)
fn = base
if hasattr(app, fn):
continue
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Cache.py
===================================================================
--- Zope/trunk/lib/python/OFS/Cache.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Cache.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,18 +14,22 @@
$Id$
"""
-import time, sys
from logging import getLogger
-import Globals
-from Globals import InitializeClass
-from Globals import DTMLFile
-from Acquisition import aq_get, aq_acquire, aq_inner, aq_parent, aq_base
+import sys
+import time
-from AccessControl import ClassSecurityInfo
-from AccessControl import getSecurityManager
+from AccessControl.Permissions import view_management_screens
from AccessControl.Role import _isBeingUsedAsAMethod
-from AccessControl import Unauthorized
-from AccessControl.Permissions import view_management_screens
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.unauthorized import Unauthorized
+from Acquisition import aq_acquire
+from Acquisition import aq_base
+from Acquisition import aq_get
+from Acquisition import aq_inner
+from Acquisition import aq_parent
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
ZCM_MANAGERS = '__ZCacheManager_ids__'
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/CopySupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/CopySupport.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/CopySupport.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,23 +15,33 @@
$Id$
"""
-import re, sys, tempfile
+from cgi import escape
+from marshal import dumps
+from marshal import loads
+import re
+import sys
+import tempfile
+from urllib import quote
+from urllib import unquote
import warnings
-from cgi import escape
-from marshal import loads, dumps
-from urllib import quote, unquote
-from zlib import compress, decompress
+from zlib import compress
+from zlib import decompress
+import transaction
-import Globals, Moniker, ExtensionClass
-import transaction
-from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager
from AccessControl.Permissions import view_management_screens
from AccessControl.Permissions import copy_or_move
from AccessControl.Permissions import delete_objects
-from Acquisition import aq_base, aq_inner, aq_parent
+from Acquisition import aq_base
+from Acquisition import aq_inner
+from Acquisition import aq_parent
+from App.class_init import default__class_init__ as InitializeClass
from App.Dialogs import MessageDialog
+from App.special_dtml import HTML
+from App.special_dtml import HTMLFile
+from App.special_dtml import DTMLFile
+from ExtensionClass import Base
from webdav.Lockable import ResourceLockedError
from zExceptions import Unauthorized, BadRequest
from ZODB.POSException import ConflictError
@@ -40,22 +50,25 @@
from zope.lifecycleevent import ObjectCopiedEvent
from zope.app.container.contained import ObjectMovedEvent
from zope.app.container.contained import notifyContainerModified
+
from OFS.event import ObjectWillBeMovedEvent
from OFS.event import ObjectClonedEvent
-import OFS.subscribers
-
from OFS.interfaces import ICopyContainer
from OFS.interfaces import ICopySource
+from OFS.Moniker import loadMoniker
+from OFS.Moniker import Moniker
+from OFS.subscribers import compatibilityCall
-class CopyError(Exception): pass
+class CopyError(Exception):
+ pass
copy_re = re.compile('^copy([0-9]*)_of_(.*)')
_marker=[]
-class CopyContainer(ExtensionClass.Base):
+class CopyContainer(Base):
"""Interface for containerish objects which allow cut/copy/paste"""
@@ -103,7 +116,7 @@
if not ob.cb_isMoveable():
raise CopyError, eNotSupported % escape(id)
- m=Moniker.Moniker(ob)
+ m = Moniker(ob)
oblist.append(m.dump())
cp=(1, oblist)
cp=_cb_encode(cp)
@@ -129,7 +142,7 @@
ob=self._getOb(id)
if not ob.cb_isCopyable():
raise CopyError, eNotSupported % escape(id)
- m=Moniker.Moniker(ob)
+ m = Moniker(ob)
oblist.append(m.dump())
cp=(0, oblist)
cp=_cb_encode(cp)
@@ -185,7 +198,7 @@
oblist = []
app = self.getPhysicalRoot()
for mdata in mdatas:
- m = Moniker.loadMoniker(mdata)
+ m = loadMoniker(mdata)
try:
ob = m.bind(app)
except ConflictError:
@@ -227,7 +240,7 @@
ob._postCopy(self, op=0)
- OFS.subscribers.compatibilityCall('manage_afterClone', ob, ob)
+ compatibilityCall('manage_afterClone', ob, ob)
notify(ObjectClonedEvent(ob))
@@ -309,7 +322,7 @@
return result
security.declareProtected(view_management_screens, 'manage_renameForm')
- manage_renameForm=Globals.DTMLFile('dtml/renameForm', globals())
+ manage_renameForm = DTMLFile('dtml/renameForm', globals())
security.declareProtected(view_management_screens, 'manage_renameObjects')
def manage_renameObjects(self, ids=[], new_ids=[], REQUEST=None):
@@ -427,7 +440,7 @@
ob._postCopy(self, op=0)
- OFS.subscribers.compatibilityCall('manage_afterClone', ob, ob)
+ compatibilityCall('manage_afterClone', ob, ob)
notify(ObjectClonedEvent(ob))
@@ -447,7 +460,7 @@
app = self.getPhysicalRoot()
for mdata in cp[1]:
- m = Moniker.loadMoniker(mdata)
+ m = loadMoniker(mdata)
oblist.append(m.bind(app))
return oblist
@@ -527,7 +540,7 @@
InitializeClass(CopyContainer)
-class CopySource(ExtensionClass.Base):
+class CopySource(Base):
"""Interface for objects which allow themselves to be copied."""
@@ -645,7 +658,7 @@
-fMessageDialog=Globals.HTML("""
+fMessageDialog = HTML("""
<HTML>
<HEAD>
<TITLE>&dtml-title;</TITLE>
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/DTMLDocument.py
===================================================================
--- Zope/trunk/lib/python/OFS/DTMLDocument.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/DTMLDocument.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,21 +14,26 @@
$Id$
"""
-from Globals import InitializeClass
-from ZPublisher.Converters import type_converters
-from Globals import HTML, DTMLFile, MessageDialog
-from zope.contenttype import guess_content_type
-from DTMLMethod import DTMLMethod, decapitate
-from PropertyManager import PropertyManager
-from webdav.common import rfc1123_date
-from webdav.Lockable import ResourceLockedError
from sgmllib import SGMLParser
from urllib import quote
+
from AccessControl import getSecurityManager
from AccessControl.Permissions import change_dtml_methods
from AccessControl.Permissions import change_dtml_documents
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
+from App.special_dtml import HTML
+from OFS.DTMLMethod import decapitate
+from OFS.DTMLMethod import DTMLMethod
+from webdav.common import rfc1123_date
+from webdav.Lockable import ResourceLockedError
from zExceptions.TracebackSupplement import PathTracebackSupplement
+from zope.contenttype import guess_content_type
+from ZPublisher.Converters import type_converters
+from OFS.PropertyManager import PropertyManager
+
done='done'
_marker = [] # Create a new marker object.
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/DTMLMethod.py
===================================================================
--- Zope/trunk/lib/python/OFS/DTMLMethod.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/DTMLMethod.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,20 +14,17 @@
$Id$
"""
-import History
-from Globals import HTML, DTMLFile, MessageDialog
-from Globals import InitializeClass
-from SimpleItem import Item_w__name__, pretty_tb
-from zope.contenttype import guess_content_type
-from PropertyManager import PropertyManager
-from AccessControl import ClassSecurityInfo
+import sys
+from urllib import quote
+
+from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.Role import RoleManager
-from webdav.common import rfc1123_date
-from webdav.Lockable import ResourceLockedError
-from ZDOM import ElementWithTitle
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
+from App.special_dtml import HTML
from DateTime.DateTime import DateTime
-from urllib import quote
-import Globals, sys, Acquisition
from AccessControl import getSecurityManager
from AccessControl.Permissions import change_dtml_methods
from AccessControl.Permissions import view_management_screens
@@ -36,18 +33,32 @@
from AccessControl.Permissions import ftp_access
from AccessControl.DTML import RestrictedDTML
from AccessControl.requestmethod import requestmethod
-from Cache import Cacheable
+from webdav.common import rfc1123_date
+from webdav.Lockable import ResourceLockedError
from zExceptions import Forbidden
from zExceptions.TracebackSupplement import PathTracebackSupplement
from ZPublisher.Iterators import IStreamIterator
+from zope.contenttype import guess_content_type
+from OFS.Cache import Cacheable
+from OFS.History import Historical
+from OFS.History import html_diff
+from OFS.PropertyManager import PropertyManager
+from OFS.SimpleItem import Item_w__name__
+from OFS.SimpleItem import pretty_tb
+from OFS.ZDOM import ElementWithTitle
+
_marker = [] # Create a new marker object.
-class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
- ElementWithTitle, Item_w__name__,
- History.Historical,
+class DTMLMethod(RestrictedDTML,
+ HTML,
+ Implicit,
+ RoleManager,
+ ElementWithTitle,
+ Item_w__name__,
+ Historical,
Cacheable,
- ):
+ ):
"""DTML Method objects are DocumentTemplate.HTML objects that act
as methods of their containers."""
meta_type='DTML Method'
@@ -59,12 +70,13 @@
security.declareObjectProtected(View)
# Documents masquerade as functions:
- class func_code: pass
+ class func_code:
+ pass
func_code=func_code()
- func_code.co_varnames='self','REQUEST','RESPONSE'
- func_code.co_argcount=3
+ func_code.co_varnames = 'self','REQUEST','RESPONSE'
+ func_code.co_argcount = 3
- manage_options=(
+ manage_options = (
(
{'label':'Edit', 'action':'manage_main',
'help':('OFSP','DTML-DocumentOrMethod_Edit.stx')},
@@ -76,10 +88,10 @@
{'label':'Proxy', 'action':'manage_proxyForm',
'help':('OFSP','DTML-DocumentOrMethod_Proxy.stx')},
)
- +History.Historical.manage_options
- +RoleManager.manage_options
- +Item_w__name__.manage_options
- +Cacheable.manage_options
+ + Historical.manage_options
+ + RoleManager.manage_options
+ + Item_w__name__.manage_options
+ + Cacheable.manage_options
)
# Careful in permissiong changes--used by DTMLDocument!
@@ -375,9 +387,7 @@
historyComparisonResults=''):
return DTMLMethod.inheritedAttribute('manage_historyCompare')(
self, rev1, rev2, REQUEST,
- historyComparisonResults=History.html_diff(
- rev1.read(), rev2.read()
- ))
+ historyComparisonResults = html_diff(rev1.read(), rev2.read()))
InitializeClass(DTMLMethod)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/FindSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/FindSupport.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/FindSupport.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,23 +17,24 @@
from string import translate
-import ExtensionClass
from AccessControl import ClassSecurityInfo
from AccessControl.DTML import RestrictedDTML
from AccessControl.Permission import name_trans
from AccessControl.Permissions import view_management_screens
from Acquisition import aq_base
-from DateTime import DateTime
+from App.special_dtml import DTMLFile
+from App.class_init import default__class_init__ as InitializeClass
+from DateTime.DateTime import DateTime
from DocumentTemplate.DT_Util import Eval
-from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
-from Globals import DTMLFile
-from Globals import InitializeClass
+from DocumentTemplate.DT_Util import InstanceDict
+from DocumentTemplate.DT_Util import TemplateDict
+from ExtensionClass import Base
from zope.interface import implements
-from interfaces import IFindSupport
+from OFS.interfaces import IFindSupport
-class FindSupport(ExtensionClass.Base):
+class FindSupport(Base):
"""Find support for Zope Folders"""
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Folder.py
===================================================================
--- Zope/trunk/lib/python/OFS/Folder.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Folder.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,18 +17,21 @@
$Id$
"""
-import AccessControl.Role, webdav.Collection
-from Globals import InitializeClass
-from AccessControl import getSecurityManager
-from AccessControl import Unauthorized
from AccessControl.Permissions import add_page_templates
from AccessControl.Permissions import add_user_folders
-from Globals import DTMLFile
+from AccessControl.Role import RoleManager
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.unauthorized import Unauthorized
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from webdav.Collection import Collection
from zope.interface import implements
-import FindSupport
-import SimpleItem, ObjectManager, PropertyManager
-from interfaces import IFolder
+from OFS.FindSupport import FindSupport
+from OFS.interfaces import IFolder
+from OFS.ObjectManager import ObjectManager
+from OFS.PropertyManager import PropertyManager
+from OFS.SimpleItem import Item
manage_addFolderForm=DTMLFile('dtml/folderAdd', globals())
@@ -70,12 +73,12 @@
class Folder(
- ObjectManager.ObjectManager,
- PropertyManager.PropertyManager,
- AccessControl.Role.RoleManager,
- webdav.Collection.Collection,
- SimpleItem.Item,
- FindSupport.FindSupport,
+ ObjectManager,
+ PropertyManager,
+ RoleManager,
+ Collection,
+ Item,
+ FindSupport,
):
"""Folders are basic container objects that provide a standard
@@ -89,15 +92,15 @@
_properties=({'id':'title', 'type': 'string','mode':'wd'},)
manage_options=(
- ObjectManager.ObjectManager.manage_options+
+ ObjectManager.manage_options+
(
{'label':'View', 'action':'',
'help':('OFSP','Folder_View.stx')},
)+
- PropertyManager.PropertyManager.manage_options+
- AccessControl.Role.RoleManager.manage_options+
- SimpleItem.Item.manage_options+
- FindSupport.FindSupport.manage_options
+ PropertyManager.manage_options+
+ RoleManager.manage_options+
+ Item.manage_options+
+ FindSupport.manage_options
)
__ac_permissions__=()
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/History.py
===================================================================
--- Zope/trunk/lib/python/OFS/History.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/History.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,19 +14,25 @@
$Id$
"""
-import Globals, ExtensionClass, difflib
-from Globals import InitializeClass
-from DateTime import DateTime
-from Acquisition import Implicit, aq_base
+from cgi import escape
+import difflib
from struct import pack, unpack
-from cgi import escape
+
+from AccessControl.Permissions import view_history
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import aq_base
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from DateTime.DateTime import DateTime
+from ExtensionClass import Base
from zExceptions import Redirect
-from AccessControl import ClassSecurityInfo
-from AccessControl.Permissions import view_history
-class TemporalParadox(Exception): pass
+class TemporalParadox(Exception):
+ pass
-class HistorySelectionError(Exception): pass
+class HistorySelectionError(Exception):
+ pass
class HystoryJar:
"""A ZODB Connection-like object that provides access to data
@@ -75,7 +81,7 @@
"We aren't real, so we delegate to that that spawned us!"
raise Redirect, REQUEST['URL2']+'/manage_change_history_page'
-class Historical(ExtensionClass.Base):
+class Historical(Base):
"""Mix-in class to provide a veiw that shows hystorical changes
The display is similar to that used for undo, except that the transactions
@@ -97,7 +103,7 @@
)
security.declareProtected(view_history, 'manage_change_history_page')
- manage_change_history_page=Globals.DTMLFile(
+ manage_change_history_page = DTMLFile(
'dtml/history', globals(),
HistoryBatchSize=20,
first_transaction=0, last_transaction=20)
@@ -155,7 +161,7 @@
def manage_afterHistoryCopy(self): pass # ? (Hook)
- _manage_historyComparePage=Globals.DTMLFile(
+ _manage_historyComparePage = DTMLFile(
'dtml/historyCompare', globals(), management_view='History')
security.declareProtected(view_history, 'manage_historyCompare')
def manage_historyCompare(self, rev1, rev2, REQUEST,
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Image.py
===================================================================
--- Zope/trunk/lib/python/OFS/Image.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Image.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,48 +14,53 @@
$Id$
"""
+from cgi import escape
+from cStringIO import StringIO
+from mimetools import choose_boundary
import struct
-from zope.contenttype import guess_content_type
-from zope.interface import implementedBy
-from zope.interface import implements
-from Globals import DTMLFile
-from Globals import InitializeClass
-from PropertyManager import PropertyManager
-from AccessControl import ClassSecurityInfo
-from AccessControl.Role import RoleManager
+
from AccessControl.Permissions import change_images_and_files
from AccessControl.Permissions import view_management_screens
from AccessControl.Permissions import view as View
from AccessControl.Permissions import ftp_access
from AccessControl.Permissions import delete_objects
+from AccessControl.Role import RoleManager
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from DateTime.DateTime import DateTime
+from Persistence import Persistent
from webdav.common import rfc1123_date
from webdav.interfaces import IWriteLock
from webdav.Lockable import ResourceLockedError
-from SimpleItem import Item_w__name__
-from cStringIO import StringIO
-from Globals import Persistent
-from Acquisition import Implicit
-from DateTime import DateTime
-from Cache import Cacheable
-from mimetools import choose_boundary
from ZPublisher import HTTPRangeSupport
from ZPublisher.HTTPRequest import FileUpload
from ZPublisher.Iterators import filestream_iterator
from zExceptions import Redirect
-from cgi import escape
-import transaction
+from zope.contenttype import guess_content_type
+from zope.interface import implementedBy
+from zope.interface import implements
-manage_addFileForm=DTMLFile('dtml/imageAdd', globals(),Kind='File',kind='file')
-def manage_addFile(self,id,file='',title='',precondition='', content_type='',
- REQUEST=None):
+from OFS.Cache import Cacheable
+from OFS.PropertyManager import PropertyManager
+from OFS.SimpleItem import Item_w__name__
+
+manage_addFileForm = DTMLFile('dtml/imageAdd',
+ globals(),
+ Kind='File',
+ kind='file',
+ )
+def manage_addFile(self, id, file='', title='', precondition='',
+ content_type='', REQUEST=None):
"""Add a new File object.
Creates a new File object 'id' with the contents of 'file'"""
- id=str(id)
- title=str(title)
- content_type=str(content_type)
- precondition=str(precondition)
+ id = str(id)
+ title = str(title)
+ content_type = str(content_type)
+ precondition = str(precondition)
id, title = cookId(id, title, file)
@@ -498,6 +503,7 @@
return content_type
def _read_data(self, file):
+ import transaction
n=1 << 16
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/ObjectManager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/ObjectManager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,12 +15,15 @@
$Id$
"""
-import warnings
-import marshal
-import sys, fnmatch, copy, os, re
from cgi import escape
from cStringIO import StringIO
-from types import StringType, UnicodeType
+import copy
+import fnmatch
+import marshal
+import os
+import re
+import sys
+import warnings
import App.Common
import App.FactoryDispatcher, Products
@@ -34,16 +37,18 @@
from AccessControl import getSecurityManager
from AccessControl.ZopeSecurityPolicy import getRoles
from Acquisition import aq_base
+from App.class_init import default__class_init__ as InitializeClass
from App.config import getConfiguration
-from Globals import InitializeClass
-from Globals import DTMLFile, Persistent
-from Globals import MessageDialog
-from Globals import REPLACEABLE, NOT_REPLACEABLE, UNIQUE
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
+from Globals import REPLACEABLE
+from Globals import NOT_REPLACEABLE
+from Globals import UNIQUE
+from Persistence import Persistent
from webdav.Collection import Collection
from webdav.Lockable import ResourceLockedError
from webdav.NullResource import NullResource
from zExceptions import BadRequest
-
from ZODB.POSException import ConflictError
from zope.interface import implements
from zope.component.interfaces import ComponentLookupError
@@ -78,8 +83,9 @@
# check_valid_id() will be called again later with allow_dup
# set to false before the object is added.
- if not id or not isinstance(id, StringType):
- if isinstance(id, UnicodeType): id = escape(id)
+ if not id or not isinstance(id, str):
+ if isinstance(id, unicode):
+ id = escape(id)
raise BadRequest, ('Empty or invalid id specified', id)
if bad_id(id) is not None:
raise BadRequest, (
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/OrderSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/OrderSupport.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/OrderSupport.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,19 +15,19 @@
$Id$
"""
-from types import StringType
import warnings
-from AccessControl import ClassSecurityInfo
+
from AccessControl.Permissions import access_contents_information
from AccessControl.Permissions import manage_properties
+from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import aq_base
+from App.class_init import default__class_init__ as InitializeClass
from DocumentTemplate.sequence import sort
-from Globals import InitializeClass
from zope.interface import implements
from zope.app.container.contained import notifyContainerModified
-from interfaces import IOrderedContainer as IOrderedContainer
-from ObjectManager import ObjectManager
+from OFS.interfaces import IOrderedContainer as IOrderedContainer
+from OFS.ObjectManager import ObjectManager
class OrderSupport(object):
@@ -138,7 +138,7 @@
suppress_events=False):
""" Move specified sub-objects by delta.
"""
- if type(ids) is StringType:
+ if type(ids) is str:
ids = (ids,)
min_position = 0
objects = list(self._objects)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/OrderedFolder.py
===================================================================
--- Zope/trunk/lib/python/OFS/OrderedFolder.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/OrderedFolder.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,16 +15,16 @@
$Id$
"""
-from AccessControl import getSecurityManager
-from AccessControl import Unauthorized
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.unauthorized import Unauthorized
from AccessControl.Permissions import add_page_templates
from AccessControl.Permissions import add_user_folders
-from Globals import DTMLFile
+from App.special_dtml import DTMLFile
from zope.interface import implements
-from Folder import Folder
-from interfaces import IOrderedFolder
-from OrderSupport import OrderSupport
+from OFS.Folder import Folder
+from OFS.interfaces import IOrderedFolder
+from OFS.OrderSupport import OrderSupport
manage_addOrderedFolderForm = DTMLFile('dtml/addOrderedFolder', globals())
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/PropertyManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/PropertyManager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/PropertyManager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -16,27 +16,27 @@
"""
from cgi import escape
-from types import ListType
-import ExtensionClass
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import access_contents_information
from AccessControl.Permissions import manage_properties
+from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import aq_base
-from Globals import DTMLFile, MessageDialog
-from Globals import Persistent
+from App.class_init import default__class_init__ as InitializeClass
+from ExtensionClass import Base
+from App.special_dtml import DTMLFile
+from App.Dialogs import MessageDialog
+from Persistence import Persistent
from zExceptions import BadRequest
from zope.interface import implements
from ZPublisher.Converters import type_converters
-import ZDOM
-from interfaces import IPropertyManager
-from PropertySheets import DefaultPropertySheets, vps
+from OFS.interfaces import IPropertyManager
+from OFS.PropertySheets import DefaultPropertySheets
+from OFS.PropertySheets import vps
+from OFS.ZDOM import ElementWithAttributes
+class PropertyManager(Base, ElementWithAttributes):
-class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
-
"""
The PropertyManager mixin class provides an object with
transparent property management. An object which wants to
@@ -170,7 +170,7 @@
def _setPropValue(self, id, value):
self._wrapperCheck(value)
- if type(value) == ListType:
+ if type(value) == list:
value = tuple(value)
setattr(self,id,value)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/PropertySheets.py
===================================================================
--- Zope/trunk/lib/python/OFS/PropertySheets.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/PropertySheets.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,34 +14,36 @@
$Id$
"""
-import time, App.Management, Globals, sys
-from webdav.interfaces import IWriteLock
-from ZPublisher.Converters import type_converters
-from Globals import InitializeClass
-from Globals import DTMLFile, MessageDialog
+from cgi import escape
+import time
+import sys
+
+from AccessControl.Permissions import access_contents_information
+from AccessControl.Permissions import manage_properties
+from AccessControl.Permissions import view_management_screens
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
from Acquisition import aq_base
from Acquisition import aq_parent
from Acquisition import Implicit, Explicit
-from App.Common import rfc1123_date, iso8601_date
-from webdav.common import urlbase
+from App.class_init import default__class_init__ as InitializeClass
+from App.Common import iso8601_date
+from App.Common import rfc1123_date
+from App.Dialogs import MessageDialog
+from App.Management import Tabs
+from App.special_dtml import DTMLFile
from ExtensionClass import Base
-from Globals import Persistent
+from Persistence import Persistent
from Traversable import Traversable
-from AccessControl import ClassSecurityInfo
-from AccessControl.Permissions import access_contents_information
-from AccessControl.Permissions import manage_properties
-from AccessControl.Permissions import view_management_screens
-from AccessControl import getSecurityManager
from webdav.common import isDavCollection
-from zExceptions import BadRequest, Redirect
-from cgi import escape
-from types import ListType
+from webdav.common import urlbase
+from webdav.interfaces import IWriteLock
+from zExceptions import BadRequest
+from zExceptions import Redirect
+from ZPublisher.Converters import type_converters
-# DM: we would like to import this from somewhere
-BadRequestException= 'Bad Request'
-
-class View(App.Management.Tabs, Base):
+class View(Tabs, Base):
"""A view of an object, typically used for management purposes
This class provides bits of management framework needed by propertysheets
@@ -215,7 +217,7 @@
else: value=[]
# bleah - can't change kw name in api, so use ugly workaround.
- if sys.modules['__builtin__'].type(value) == ListType:
+ if sys.modules['__builtin__'].type(value) == list:
value = tuple(value)
setattr(self, id, value)
@@ -242,7 +244,7 @@
props.append(prop)
pself._properties=tuple(props)
- if type(value) == ListType:
+ if type(value) == list:
value = tuple(value)
setattr(self.v_self(), id, value)
@@ -409,7 +411,7 @@
# Web interface
- manage=DTMLFile('dtml/properties', globals())
+ manage = DTMLFile('dtml/properties', globals())
security.declareProtected(manage_properties, 'manage_propertiesForm')
def manage_propertiesForm(self, URL1):
@@ -614,7 +616,7 @@
InitializeClass(DAVProperties)
-class PropertySheets(Traversable, Implicit, App.Management.Tabs):
+class PropertySheets(Traversable, Implicit, Tabs):
"""A tricky container to keep property sets from polluting
an object's direct attribute namespace."""
@@ -708,7 +710,8 @@
'''delete all sheets identified by *ids*.'''
for id in ids:
if not self.isDeletable(id):
- raise BadRequestException, 'attempt to delete undeletable property sheet: ' + id
+ raise BadRequest(
+ 'attempt to delete undeletable property sheet: ' + id)
self.delPropertySheet(id)
if REQUEST is not None:
REQUEST.RESPONSE.redirect('%s/manage' % self.absolute_url())
@@ -723,7 +726,7 @@
# Management interface:
security.declareProtected(view_management_screens, 'manage')
- manage=Globals.DTMLFile('dtml/propertysheets', globals())
+ manage = DTMLFile('dtml/propertysheets', globals())
def manage_options(self):
"""Return a manage option data structure for me instance
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/SimpleItem.py
===================================================================
--- Zope/trunk/lib/python/OFS/SimpleItem.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/SimpleItem.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -21,42 +21,59 @@
"""
import inspect
+import marshal
+import re
+import sys
+import time
import warnings
-import marshal, re, sys, time
-import AccessControl.Role, AccessControl.Owned, App.Common
-import Globals, App.Management, Acquisition, App.Undo
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
-from AccessControl import getSecurityManager, Unauthorized
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.Owned import Owned
from AccessControl.Permissions import view as View
+from AccessControl.Role import RoleManager
+from AccessControl.unauthorized import Unauthorized
from AccessControl.ZopeSecurityPolicy import getRoles
-from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire
+from Acquisition import Acquired
+from Acquisition import aq_acquire
+from Acquisition import aq_base
+from Acquisition import aq_inner
+from Acquisition import aq_parent
+from Acquisition import Implicit
+from App.Management import Tabs
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import HTML
+from App.special_dtml import DTMLFile
+from App.Undo import UndoSupport
from ComputedAttribute import ComputedAttribute
from DocumentTemplate.html_quote import html_quote
from DocumentTemplate.ustr import ustr
from ExtensionClass import Base
+from Persistence import Persistent
from webdav.Resource import Resource
-from zExceptions import Redirect, upgradeException
+from zExceptions import Redirect
+from zExceptions import upgradeException
from zExceptions.ExceptionFormatter import format_exception
from zope.interface import implements
-import ZDOM
-from CopySupport import CopySource
-from interfaces import IItem
-from interfaces import IItemWithName
-from interfaces import ISimpleItem
-from Traversable import Traversable
+from OFS.interfaces import IItem
+from OFS.interfaces import IItemWithName
+from OFS.interfaces import ISimpleItem
+from OFS.CopySupport import CopySource
+from OFS.Traversable import Traversable
+from OFS.ZDOM import Element
-HTML=Globals.HTML
-
import logging
logger = logging.getLogger()
-class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
- ZDOM.Element,
- AccessControl.Owned.Owned,
- App.Undo.UndoSupport,
+class Item(Base,
+ Resource,
+ CopySource,
+ Tabs,
+ Traversable,
+ Element,
+ Owned,
+ UndoSupport,
):
"""A common base class for simple, non-container objects."""
@@ -115,14 +132,14 @@
__propsets__=()
manage_options=(
- App.Undo.UndoSupport.manage_options
- +AccessControl.Owned.Owned.manage_options
- +({'label': 'Interfaces',
- 'action': 'manage_interfaces'},)
+ UndoSupport.manage_options
+ + Owned.manage_options
+ + ({'label': 'Interfaces',
+ 'action': 'manage_interfaces'},)
)
# Attributes that must be acquired
- REQUEST=Acquisition.Acquired
+ REQUEST = Acquired
# Allow (reluctantly) access to unprotected attributes
__allow_access_to_unprotected_subobjects__=1
@@ -159,7 +176,7 @@
# My sub-objects as used by the tree tag
return ()
- _manage_editedDialog=Globals.DTMLFile('dtml/editedDialog', globals())
+ _manage_editedDialog = DTMLFile('dtml/editedDialog', globals())
def manage_editedDialog(self, REQUEST, **args):
return apply(self._manage_editedDialog,(self, REQUEST), args)
@@ -358,10 +375,11 @@
In the case of non-Foldoid objects, the listing should contain one
object, the object itself.
"""
+ from App.Common import is_acquired
# check to see if we are being acquiring or not
ob=self
while 1:
- if App.Common.is_acquired(ob):
+ if is_acquired(ob):
raise ValueError('FTP List not supported on acquired objects')
if not hasattr(ob,'aq_parent'):
break
@@ -449,9 +467,10 @@
return tb
-class SimpleItem(Item, Globals.Persistent,
- Acquisition.Implicit,
- AccessControl.Role.RoleManager,
+class SimpleItem(Item,
+ Persistent,
+ Implicit,
+ RoleManager,
):
# Blue-plate special, Zope Masala
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Traversable.py
===================================================================
--- Zope/trunk/lib/python/OFS/Traversable.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Traversable.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,22 +17,27 @@
from urllib import quote
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
-from AccessControl import getSecurityManager
-from AccessControl import Unauthorized
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.unauthorized import Unauthorized
from AccessControl.ZopeGuards import guarded_getattr
-from Acquisition import Acquired, aq_inner, aq_parent, aq_acquire, aq_base
+from Acquisition import Acquired
+from Acquisition import aq_acquire
+from Acquisition import aq_base
+from Acquisition import aq_inner
+from Acquisition import aq_parent
from Acquisition.interfaces import IAcquirer
+from App.class_init import default__class_init__ as InitializeClass
+from OFS.interfaces import ITraversable
from zExceptions import NotFound
from ZODB.POSException import ConflictError
-from OFS.interfaces import ITraversable
-import webdav
-from zope.interface import implements, Interface
+from zope.interface import implements
+from zope.interface import Interface
from zope.component import queryMultiAdapter
from zope.traversing.interfaces import TraversalError
-from zope.traversing.namespace import nsParse, namespaceLookup
+from zope.traversing.namespace import namespaceLookup
+from zope.traversing.namespace import nsParse
_marker = object()
@@ -138,6 +143,7 @@
If true, then all of the objects along the path are validated with
the security machinery. Usually invoked using restrictedTraverse().
"""
+ from webdav.NullResource import NullResource
if not path:
return self
@@ -245,8 +251,7 @@
# The item lookup may return a NullResource,
# if this is the case we save it and return it
# if all other lookups fail.
- if isinstance(next,
- webdav.NullResource.NullResource):
+ if isinstance(next, NullResource):
resource = next
raise KeyError(name)
except AttributeError:
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Uninstalled.py
===================================================================
--- Zope/trunk/lib/python/OFS/Uninstalled.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/Uninstalled.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -13,20 +13,21 @@
"""
Objects for packages that have been uninstalled.
"""
-import SimpleItem, Globals, Acquisition
-from Acquisition import Acquired
-import Persistence
-from thread import allocate_lock
-
from cgi import escape
from logging import getLogger
+from thread import allocate_lock
+from Acquisition import Acquired
+from Acquisition import Explicit
+from App.special_dtml import DTMLFile
+from OFS.SimpleItem import Item
+from Persistence import Overridable
+
broken_klasses={}
broken_klasses_lock = allocate_lock()
LOG = getLogger('OFS.Uninstalled')
-class BrokenClass(Acquisition.Explicit, SimpleItem.Item,
- Persistence.Overridable):
+class BrokenClass(Explicit, Item, Overridable):
_p_changed=0
meta_type='Broken Because Product is Gone'
icon='p_/broken'
@@ -47,9 +48,9 @@
return BrokenClass.inheritedAttribute('__getattr__')(self, name)
raise AttributeError, escape(name)
- manage=Globals.DTMLFile('dtml/brokenEdit',globals())
- manage_main=Globals.DTMLFile('dtml/brokenEdit',globals())
- manage_workspace=Globals.DTMLFile('dtml/brokenEdit',globals())
+ manage = DTMLFile('dtml/brokenEdit',globals())
+ manage_main = DTMLFile('dtml/brokenEdit',globals())
+ manage_workspace = DTMLFile('dtml/brokenEdit',globals())
def Broken(self, oid, pair):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/ZDOM.py
===================================================================
--- Zope/trunk/lib/python/OFS/ZDOM.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/ZDOM.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,12 +15,13 @@
All standard Zope objects support DOM to a limited extent.
"""
-import Acquisition
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.Permissions import access_contents_information
+from Acquisition import Explicit
+from Acquisition import Implicit
from Acquisition import aq_base
from Acquisition import aq_parent
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
-from AccessControl.Permissions import access_contents_information
+from App.class_init import default__class_init__ as InitializeClass
# Node type codes
@@ -167,7 +168,7 @@
InitializeClass(Node)
-class Document(Acquisition.Explicit, Node):
+class Document(Explicit, Node):
"""
Document Interface
"""
@@ -534,7 +535,7 @@
return None
-class Attr(Acquisition.Implicit, Node):
+class Attr(Implicit, Node):
"""
Attr interface - The Attr interface represents an attriubte in an
Element object. Attr objects inherit the Node Interface
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/OFS/misc_.py
===================================================================
--- Zope/trunk/lib/python/OFS/misc_.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/OFS/misc_.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -11,11 +11,10 @@
#
##############################################################################
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from App.class_init import default__class_init__ as InitializeClass
from App.ImageFile import ImageFile
-
class misc_:
"Miscellaneous product information"
security = ClassSecurityInfo()
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -16,34 +16,36 @@
$Id: BTreeFolder2.py,v 1.27 2004/03/17 22:49:25 urbanape Exp $
"""
+from cgi import escape
+from logging import getLogger
+from random import randint
import sys
-from cgi import escape
from urllib import quote
-from random import randint
-from types import StringType
-from logging import getLogger
-import Globals
-from Globals import DTMLFile
-from Globals import Persistent
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.Permissions import access_contents_information
+from AccessControl.Permissions import view_management_screens
from Acquisition import aq_base
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from BTrees.Length import Length
+from BTrees.OIBTree import OIBTree
+from BTrees.OIBTree import union
from BTrees.OOBTree import OOBTree
-from BTrees.OIBTree import OIBTree, union
-from BTrees.Length import Length
-from ZODB.POSException import ConflictError
-from OFS.ObjectManager import BadRequestException, BeforeDeleteException
+from OFS.event import ObjectWillBeAddedEvent
+from OFS.event import ObjectWillBeRemovedEvent
from OFS.Folder import Folder
-from AccessControl import getSecurityManager, ClassSecurityInfo
-from AccessControl.Permissions import access_contents_information, \
- view_management_screens
+from OFS.ObjectManager import BadRequestException
+from OFS.ObjectManager import BeforeDeleteException
+from OFS.subscribers import compatibilityCall
+from Persistence import Persistent
from Products.ZCatalog.Lazy import LazyMap
+from ZODB.POSException import ConflictError
from zope.event import notify
from zope.app.container.contained import ObjectAddedEvent
from zope.app.container.contained import ObjectRemovedEvent
from zope.app.container.contained import notifyContainerModified
-from OFS.event import ObjectWillBeAddedEvent
-from OFS.event import ObjectWillBeRemovedEvent
-import OFS.subscribers
LOG = getLogger('BTreeFolder2')
@@ -346,7 +348,7 @@
if spec is None:
spec = mti.keys() #all meta types
- if isinstance(spec, StringType):
+ if isinstance(spec, str):
spec = [spec]
set = None
for meta_type in spec:
@@ -448,7 +450,7 @@
notify(ObjectAddedEvent(ob, self, id))
notifyContainerModified(self)
- OFS.subscribers.compatibilityCall('manage_afterAdd', ob, ob, self)
+ compatibilityCall('manage_afterAdd', ob, ob, self)
return id
@@ -456,7 +458,7 @@
def _delObject(self, id, dp=1, suppress_events=False):
ob = self._getOb(id)
- OFS.subscribers.compatibilityCall('manage_beforeDelete', ob, ob, self)
+ compatibilityCall('manage_beforeDelete', ob, ob, self)
if not suppress_events:
notify(ObjectWillBeRemovedEvent(ob, self, id))
@@ -519,7 +521,7 @@
return res
-Globals.InitializeClass(BTreeFolder2Base)
+InitializeClass(BTreeFolder2Base)
class BTreeFolder2 (BTreeFolder2Base, Folder):
@@ -532,5 +534,5 @@
BTreeFolder2Base._checkId(self, id, allow_dup)
-Globals.InitializeClass(BTreeFolder2)
+InitializeClass(BTreeFolder2)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ExternalMethod/ExternalMethod.py
===================================================================
--- Zope/trunk/lib/python/Products/ExternalMethod/ExternalMethod.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ExternalMethod/ExternalMethod.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -10,24 +10,36 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
-
"""External Method Product
This product provides support for external methods, which allow
domain-specific customization of web environments.
"""
__version__='$Revision: 1.52 $'[11:-2]
-from Globals import Persistent, DTMLFile, MessageDialog, HTML
-import OFS.SimpleItem, Acquisition
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
+
+import os
+import stat
+import sys
+import traceback
+
from AccessControl.Permissions import change_external_methods
from AccessControl.Permissions import view_management_screens
from AccessControl.Permissions import view as View
-import AccessControl.Role, sys, os, stat, traceback
+from AccessControl.Role import RoleManager
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Acquired
+from Acquisition import Explicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
+from App.Extensions import getObject
+from App.Extensions import getPath
+from App.Extensions import FuncCode
+from App.special_dtml import DTMLFile
+from App.special_dtml import HTML
+import Globals # for data
+from OFS.SimpleItem import Item
from OFS.SimpleItem import pretty_tb
-from App.Extensions import getObject, getPath, FuncCode
-from Globals import DevelopmentMode
+from Persistence import Persistent
from App.Management import Navigation
from ComputedAttribute import ComputedAttribute
@@ -66,8 +78,8 @@
if REQUEST is not None:
return self.manage_main(self,REQUEST)
-class ExternalMethod(OFS.SimpleItem.Item, Persistent, Acquisition.Explicit,
- AccessControl.Role.RoleManager, Navigation):
+class ExternalMethod(Item, Persistent, Explicit,
+ RoleManager, Navigation):
"""Web-callable functions that encapsulate external python functions.
The function is defined in an external file. This file is treated
@@ -93,9 +105,9 @@
func_code = ComputedAttribute(lambda self: self.getFuncCode())
- ZopeTime=Acquisition.Acquired
- HelpSys=Acquisition.Acquired
- manage_page_header=Acquisition.Acquired
+ ZopeTime = Acquired
+ HelpSys = Acquired
+ manage_page_header = Acquired
manage_options=(
(
@@ -104,8 +116,8 @@
{'label':'Test', 'action':'',
'help':('ExternalMethod','External-Method_Try-It.stx')},
)
- +OFS.SimpleItem.Item.manage_options
- +AccessControl.Role.RoleManager.manage_options
+ + Item.manage_options
+ + RoleManager.manage_options
)
def __init__(self, id, title, module, function):
@@ -162,7 +174,7 @@
self._v_f=self.getFunction(1)
self._v_last_read=ts
- if DevelopmentMode:
+ if Globals.DevelopmentMode:
# In development mode we do an automatic reload
# if the module code changed
def getFuncDefaults(self):
@@ -218,7 +230,7 @@
"external method could not be called " \
"because the file does not exist"
- if DevelopmentMode:
+ if Globals.DevelopmentMode:
self.reloadIfChanged()
if hasattr(self, '_v_f'):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/browser/metaconfigure.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/metaconfigure.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/browser/metaconfigure.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -26,13 +26,14 @@
from zope.component.zcml import handler
from zope.component.interface import provideInterface
from zope.configuration.exceptions import ConfigurationError
-from zope.publisher.interfaces.browser import IBrowserRequest, \
- IDefaultBrowserLayer
+from zope.publisher.interfaces.browser import IBrowserRequest
+from zope.publisher.interfaces.browser import IDefaultBrowserLayer
import zope.app.publisher.browser.viewmeta
import zope.app.pagetemplate.simpleviewclass
-from zope.app.publisher.browser.viewmeta import (providesCallable,
- _handle_menu, _handle_for)
+from zope.app.publisher.browser.viewmeta import providesCallable
+from zope.app.publisher.browser.viewmeta import _handle_menu
+from zope.app.publisher.browser.viewmeta import _handle_for
from Products.Five.browser import BrowserView
from Products.Five.browser.resource import FileResourceFactory
@@ -41,10 +42,12 @@
from Products.Five.browser.resource import DirectoryResourceFactory
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.Five.metaclass import makeClass
-from Products.Five.security import getSecurityInfo, protectClass, protectName
+from Products.Five.security import getSecurityInfo
+from Products.Five.security import protectClass
+from Products.Five.security import protectName
from Products.Five.security import CheckerPrivateId
-from Globals import InitializeClass as initializeClass
+from App.class_init import default__class_init__ as initializeClass
def page(_context, name, permission, for_,
layer=IDefaultBrowserLayer, template=None, class_=None,
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/form/metaconfigure.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/form/metaconfigure.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/form/metaconfigure.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,8 +15,8 @@
$Id$
"""
-import ExtensionClass
-from Globals import InitializeClass as initializeClass
+from App.class_init import default__class_init__ as InitializeClass
+from ExtensionClass import Base
import zope.component
from zope.interface import Interface
@@ -67,7 +67,7 @@
def _processWidgets(self):
if self._widgets:
customWidgetsObject = makeClass(
- 'CustomWidgetsMixin', (ExtensionClass.Base,), self._widgets)
+ 'CustomWidgetsMixin', (Base,), self._widgets)
self.bases = self.bases + (customWidgetsObject,)
class EditFormDirective(FiveFormDirective):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/security.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/security.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/security.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -23,7 +23,7 @@
from zope.security.simplepolicies import ParanoidSecurityPolicy
from AccessControl import ClassSecurityInfo, getSecurityManager
-from Globals import InitializeClass as initializeClass
+from App.class_init import default__class_init__ as initializeClass
CheckerPublicId = 'zope.Public'
CheckerPrivateId = 'zope2.Private'
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/tests/test_security.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/test_security.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/tests/test_security.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -95,7 +95,7 @@
... '''
>>> zcml.load_string(configure_zcml)
- >>> from Globals import InitializeClass
+ >>> from App.class_init import default__class_init__ as InitializeClass
>>> InitializeClass(Dummy2)
Now we compare their access controls:
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/viewlet/metaconfigure.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/viewlet/metaconfigure.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/Five/viewlet/metaconfigure.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -16,6 +16,7 @@
$Id$
"""
import os
+
from zope.app.publisher.browser import viewmeta
from zope.component import zcml
from zope.configuration.exceptions import ConfigurationError
@@ -26,8 +27,10 @@
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from zope.viewlet import interfaces
-from Globals import InitializeClass as initializeClass
-from Products.Five.security import protectClass, protectName
+from App.class_init import default__class_init__ as initializeClass
+from App.special_dtml import DTMLFile
+from Products.Five.security import protectClass
+from Products.Five.security import protectName
from Products.Five.viewlet import manager
from Products.Five.viewlet import viewlet
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/MailHost/MailHost.py
===================================================================
--- Zope/trunk/lib/python/Products/MailHost/MailHost.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/MailHost/MailHost.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,22 +14,23 @@
$Id$
"""
-
+from cStringIO import StringIO
+import logging
import mimetools
import rfc822
+from threading import Lock
import time
-import logging
-from cStringIO import StringIO
-from threading import Lock
-import Acquisition
-import OFS.SimpleItem
-from AccessControl import ClassSecurityInfo
+from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.Permissions import change_configuration, view
from AccessControl.Permissions import use_mailhost_services
from AccessControl.Role import RoleManager
-from Globals import Persistent, DTMLFile, InitializeClass
-from DateTime import DateTime
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from DateTime.DateTime import DateTime
+from Persistence import Persistent
+from OFS.SimpleItem import Item
from zope.interface import implements
from zope.sendmail.maildir import Maildir
@@ -51,11 +52,18 @@
class MailHostError(Exception):
pass
-manage_addMailHostForm=DTMLFile('dtml/addMailHost_form', globals())
-def manage_addMailHost( self, id, title='', smtp_host='localhost'
- , localhost='localhost', smtp_port=25
- , timeout=1.0, REQUEST=None ):
- ' add a MailHost into the system '
+manage_addMailHostForm = DTMLFile('dtml/addMailHost_form', globals())
+def manage_addMailHost(self,
+ id,
+ title='',
+ smtp_host='localhost',
+ localhost='localhost',
+ smtp_port=25,
+ timeout=1.0,
+ REQUEST=None,
+ ):
+ """ Add a MailHost into the system.
+ """
i = MailHost( id, title, smtp_host, smtp_port ) #create new mail host
self._setObject( id,i ) #register it
@@ -65,41 +73,50 @@
add = manage_addMailHost
-class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
+class MailBase(Implicit, Item, RoleManager):
"""a mailhost...?"""
implements(IMailHost)
- meta_type='Mail Host'
- manage=manage_main=DTMLFile('dtml/manageMailHost', globals())
+ meta_type = 'Mail Host'
+ manage = manage_main = DTMLFile('dtml/manageMailHost', globals())
manage_main._setName('manage_main')
- index_html=None
+ index_html = None
security = ClassSecurityInfo()
- smtp_uid='' # Class attributes for smooth upgrades
- smtp_pwd=''
+ smtp_uid = '' # Class attributes for smooth upgrades
+ smtp_pwd = ''
smtp_queue = False
smtp_queue_directory = '/tmp'
force_tls = False
lock = Lock()
- # timeout=1.0 # unused?
+ # timeout = 1.0 # unused?
- manage_options=(
+ manage_options = (
(
{'icon':'', 'label':'Edit',
'action':'manage_main',
'help':('MailHost','Mail-Host_Edit.stx')},
)
- +RoleManager.manage_options
- +OFS.SimpleItem.Item.manage_options
+ + RoleManager.manage_options
+ + Item.manage_options
)
- def __init__(self, id='', title='', smtp_host='localhost', smtp_port=25,
+ def __init__(self,
+ id='',
+ title='',
+ smtp_host='localhost',
+ smtp_port=25,
force_tls=False,
- smtp_uid='', smtp_pwd='', smtp_queue=False, smtp_queue_directory='/tmp'):
- """Initialize a new MailHost instance """
+ smtp_uid='',
+ smtp_pwd='',
+ smtp_queue=False,
+ smtp_queue_directory='/tmp',
+ ):
+ """Initialize a new MailHost instance.
+ """
self.id = id
self.title = title
self.smtp_host = str( smtp_host )
@@ -113,23 +130,30 @@
# staying for now... (backwards compatibility)
def _init(self, smtp_host, smtp_port):
- self.smtp_host=smtp_host
- self.smtp_port=smtp_port
+ self.smtp_host = smtp_host
+ self.smtp_port = smtp_port
security.declareProtected(change_configuration, 'manage_makeChanges')
- def manage_makeChanges(self,title,smtp_host,smtp_port,smtp_uid='',smtp_pwd='',
- smtp_queue=False, smtp_queue_directory='/tmp',
+ def manage_makeChanges(self,
+ title,
+ smtp_host,
+ smtp_port,
+ smtp_uid='',
+ smtp_pwd='',
+ smtp_queue=False,
+ smtp_queue_directory='/tmp',
force_tls=False,
- REQUEST=None):
- 'make the changes'
+ REQUEST=None,
+ ):
+ """Make the changes.
+ """
+ title = str(title)
+ smtp_host = str(smtp_host)
+ smtp_port = int(smtp_port)
- title=str(title)
- smtp_host=str(smtp_host)
- smtp_port=int(smtp_port)
-
- self.title=title
- self.smtp_host=smtp_host
- self.smtp_port=smtp_port
+ self.title = title
+ self.smtp_host = smtp_host
+ self.smtp_port = smtp_port
self.smtp_uid = smtp_uid
self.smtp_pwd = smtp_pwd
self.force_tls = force_tls
@@ -152,30 +176,45 @@
)
security.declareProtected(use_mailhost_services, 'sendTemplate')
- def sendTemplate(trueself, self, messageTemplate,
- statusTemplate=None, mto=None, mfrom=None,
- encode=None, REQUEST=None, immediate=False):
- 'render a mail template, then send it...'
+ def sendTemplate(trueself,
+ self,
+ messageTemplate,
+ statusTemplate=None,
+ mto=None,
+ mfrom=None,
+ encode=None,
+ REQUEST=None,
+ immediate=False,
+ ):
+ """Render a mail template, then send it...
+ """
mtemplate = getattr(self, messageTemplate)
messageText = mtemplate(self, trueself.REQUEST)
messageText, mto, mfrom = _mungeHeaders( messageText, mto, mfrom)
- messageText=_encode(messageText, encode)
+ messageText = _encode(messageText, encode)
trueself._send(mfrom, mto, messageText, immediate)
if not statusTemplate:
return "SEND OK"
try:
- stemplate=getattr(self, statusTemplate)
+ stemplate = getattr(self, statusTemplate)
return stemplate(self, trueself.REQUEST)
except:
return "SEND OK"
security.declareProtected(use_mailhost_services, 'send')
- def send(self, messageText, mto=None, mfrom=None, subject=None,
- encode=None, immediate=False):
+ def send(self,
+ messageText,
+ mto=None,
+ mfrom=None,
+ subject=None,
+ encode=None,
+ immediate=False,
+ ):
- messageText, mto, mfrom = _mungeHeaders( messageText, mto, mfrom, subject)
+ messageText, mto, mfrom = _mungeHeaders(messageText,
+ mto, mfrom, subject)
messageText = _encode(messageText, encode)
self._send(mfrom, mto, messageText, immediate)
@@ -186,7 +225,7 @@
security.declareProtected(use_mailhost_services, 'simple_send')
def simple_send(self, mto, mfrom, subject, body, immediate=False):
- body="From: %s\nTo: %s\nSubject: %s\n\n%s" % (
+ body = "From: %s\nTo: %s\nSubject: %s\n\n%s" % (
mfrom, mto, subject, body)
self._send(mfrom, mto, body, immediate)
@@ -199,7 +238,7 @@
username=self.smtp_uid or None,
password=self.smtp_pwd or None,
force_tls=self.force_tls
- )
+ )
@synchronized(lock)
def _stopQueueProcessorThread(self):
@@ -292,11 +331,11 @@
def _encode(body, encode=None):
if encode is None:
return body
- mfile=StringIO(body)
- mo=mimetools.Message(mfile)
+ mfile = StringIO(body)
+ mo = mimetools.Message(mfile)
if mo.getencoding() != '7bit':
raise MailHostError, 'Message already encoded'
- newmfile=StringIO()
+ newmfile = StringIO()
newmfile.write(''.join(mo.headers))
newmfile.write('Content-Transfer-Encoding: %s\n' % encode)
if not mo.has_key('Mime-Version'):
@@ -308,12 +347,12 @@
def _mungeHeaders( messageText, mto=None, mfrom=None, subject=None):
"""Sets missing message headers, and deletes Bcc.
returns fixed message, fixed mto and fixed mfrom"""
- mfile=StringIO(messageText.lstrip())
- mo=rfc822.Message(mfile)
+ mfile = StringIO(messageText.lstrip())
+ mo = rfc822.Message(mfile)
# Parameters given will *always* override headers in the messageText.
- # This is so that you can't override or add to subscribers by adding them to
- # the message text.
+ # This is so that you can't override or add to subscribers by adding
+ # them to # the message text.
if subject:
mo['Subject'] = subject
elif not mo.getheader('Subject'):
@@ -321,7 +360,8 @@
if mto:
if isinstance(mto, basestring):
- mto = [rfc822.dump_address_pair(addr) for addr in rfc822.AddressList(mto) ]
+ mto = [rfc822.dump_address_pair(addr)
+ for addr in rfc822.AddressList(mto) ]
if not mo.getheader('To'):
mo['To'] = ','.join(mto)
else:
@@ -329,7 +369,8 @@
for header in ('To', 'Cc', 'Bcc'):
v = mo.getheader(header)
if v:
- mto += [rfc822.dump_address_pair(addr) for addr in rfc822.AddressList(v)]
+ mto += [rfc822.dump_address_pair(addr)
+ for addr in rfc822.AddressList(v)]
if not mto:
raise MailHostError, "No message recipients designated"
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/OFSP/Draft.py
===================================================================
--- Zope/trunk/lib/python/Products/OFSP/Draft.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/OFSP/Draft.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -10,14 +10,15 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
-import Globals, AccessControl.User
-from Globals import Persistent
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
+from AccessControl.SecurityInfo import ClassSecurityInfo
+import AccessControl.User
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import HTMLFile
from Acquisition import Implicit
from OFS import SimpleItem
+from Persistence import Persistent
-manage_addPrincipiaDraftForm=Globals.HTMLFile('dtml/draftAdd',globals())
+manage_addPrincipiaDraftForm = HTMLFile('dtml/draftAdd',globals())
def manage_addPrincipiaDraft(self, id, baseid, PATH_INFO, REQUEST=None):
"Add a draft object"
self._setObject(id, Draft(id, baseid, PATH_INFO))
@@ -69,21 +70,28 @@
self.id,
))
- def __bobo_traverse__(self, REQUEST, name):
+
+ def _getVersionBase(self):
+ import Globals # for data
+ versionbase = getattr(Globals, 'VersionBase', {})
+ return versionbase.get(self._version)
+
+ def _bobo_traverse__(self, REQUEST, name):
if name[-9:]=='__draft__': return getattr(self, name)
- try: db=self._p_jar.db()
+ try:
+ db = self._p_jar.db()
except:
# BoboPOS 2
- jar = Globals.VersionBase[self._version].jar
+ vb = self._getVersionBase()
+ jar = vb and vb.jar
else:
# ZODB 3
jar = db.open(self._version)
cleanup = Cleanup(jar)
REQUEST[Cleanup]=cleanup
-
dself=getdraft(self, jar)
ref=getattr(dself.aq_parent.aq_base,dself._refid).aq_base.__of__(dself)
@@ -94,14 +102,15 @@
try: db=self._p_jar.db()
except:
# BoboPOS 2
- return Globals.VersionBase[self._version].nonempty()
+ vb = self._getVersionBase()
+ return vb and vb.nonempty()
else:
# ZODB 3
return not db.versionEmpty(self._version)
security.declareProtected('Approve draft changes',
'manage_approve__draft__')
- manage_approve__draft__=Globals.HTMLFile('dtml/draftApprove', globals())
+ manage_approve__draft__ = HTMLFile('dtml/draftApprove', globals())
security.declareProtected('Approve draft changes',
'manage_Save__draft__')
@@ -110,7 +119,8 @@
try: db=self._p_jar.db()
except:
# BoboPOS 2
- Globals.VersionBase[self._version].commit(remark)
+ vb = self._getVersionBase()
+ vb.commit(remark)
else:
# ZODB 3
s=self._version
@@ -128,7 +138,8 @@
try: db=self._p_jar.db()
except:
# BoboPOS 2
- Globals.VersionBase[self._version].abort()
+ vb = self._getVersionBase()
+ vb.abort()
else:
# ZODB 3
db.abortVersion(self._version)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/OFSP/Version.py
===================================================================
--- Zope/trunk/lib/python/Products/OFSP/Version.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/OFSP/Version.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,28 +14,29 @@
__version__='$Revision: 1.55 $'[11:-2]
-import Globals, time
-from AccessControl.Role import RoleManager
-from Globals import MessageDialog
-from Globals import Persistent
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
+from cgi import escape
+import time
+
from AccessControl.Permissions import change_versions
from AccessControl.Permissions import join_leave_versions
from AccessControl.Permissions import save_discard_version_changes
from AccessControl.Permissions import view_management_screens
+from AccessControl.Role import RoleManager
+from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
+from App.special_dtml import HTML
from OFS.SimpleItem import Item
-from Globals import HTML
-from App.Dialogs import MessageDialog
+from Persistence import Persistent
from OFS.ObjectManager import BeforeDeleteException
-from cgi import escape
-
import transaction
-class VersionException(BeforeDeleteException): pass
+class VersionException(BeforeDeleteException):
+ pass
-manage_addVersionForm=Globals.DTMLFile('dtml/versionAdd', globals())
+manage_addVersionForm = DTMLFile('dtml/versionAdd', globals())
def manage_addVersion(self, id, title, REQUEST=None):
""" """
@@ -77,23 +78,32 @@
self.title=title
security.declareProtected(join_leave_versions, 'manage_main')
- manage_main=Globals.DTMLFile('dtml/version', globals())
+ manage_main = DTMLFile('dtml/version', globals())
security.declareProtected(save_discard_version_changes, 'manage_end')
- manage_end=Globals.DTMLFile('dtml/versionEnd', globals())
+ manage_end = DTMLFile('dtml/versionEnd', globals())
security.declareProtected(view_management_screens, 'manage_editForm')
- manage_editForm =Globals.DTMLFile('dtml/versionEdit', globals())
+ manage_editForm = DTMLFile('dtml/versionEdit', globals())
+ def _getVersionBaseCookie(self):
+ import Globals # for data
+ versionbase = getattr(Globals, 'VersionBase', {})
+ return versionbase.get(self.cookie)
+
def title_and_id(self):
- r=Version.inheritedAttribute('title_and_id')(self)
- try: db=self._p_jar.db()
+ r = Version.inheritedAttribute('title_and_id')(self)
+ try:
+ db = self._p_jar.db()
except:
# BoboPOS 2
- if Globals.VersionBase[self.cookie].nonempty(): return '%s *' % r
+ vbc = self._getVersionBaseCookie()
+ if vbc and vbc.nonempty():
+ return '%s *' % r
else:
# ZODB 3
- if not db.versionEmpty(self.cookie): return '%s *' % r
+ if not db.versionEmpty(self.cookie):
+ return '%s *' % r
return r
@@ -116,7 +126,9 @@
security.declareProtected(join_leave_versions, 'enter')
def enter(self, REQUEST, RESPONSE):
- """Begin working in a version"""
+ """Begin working in a version.
+ """
+ import Globals
RESPONSE.setCookie(
Globals.VersionNameName, self.cookie,
path=(REQUEST['BASEPATH1'] or '/'),
@@ -134,7 +146,9 @@
security.declareProtected(join_leave_versions, 'leave')
def leave(self, REQUEST, RESPONSE):
- """Temporarily stop working in a version"""
+ """Temporarily stop working in a version
+ """
+ import Globals
RESPONSE.setCookie(
Globals.VersionNameName,'No longer active',
expires="Mon, 25-Jan-1999 23:59:59 GMT",
@@ -159,10 +173,13 @@
security.declareProtected(save_discard_version_changes, 'save')
def save(self, remark, REQUEST=None):
"""Make version changes permanent"""
- try: db=self._p_jar.db()
+ try:
+ db = self._p_jar.db()
except:
# BoboPOS 2
- Globals.VersionBase[self.cookie].commit(remark)
+ vbc = self._getVersionBaseCookie()
+ if vbc:
+ vbc.commit(remark)
else:
# ZODB 3
s=self.cookie
@@ -177,10 +194,13 @@
security.declareProtected(save_discard_version_changes, 'discard')
def discard(self, remark='', REQUEST=None):
'Discard changes made during the version'
- try: db=self._p_jar.db()
+ try:
+ db = self._p_jar.db()
except:
# BoboPOS 2
- Globals.VersionBase[self.cookie].abort()
+ vbc = self._getVersionBaseCookie()
+ if vbc:
+ vbc.abort()
else:
# ZODB 3
transaction.get().note(remark)
@@ -190,10 +210,12 @@
REQUEST['RESPONSE'].redirect(REQUEST['URL1']+'/manage_main')
def nonempty(self):
- try: db=self._p_jar.db()
+ try:
+ db = self._p_jar.db()
except:
# BoboPOS 2
- return Globals.VersionBase[self.cookie].nonempty()
+ vbc = self._getVersionBaseCookie()
+ return vbc and vbc.nonempty()
else:
# ZODB 3
return not db.versionEmpty(self.cookie)
@@ -212,6 +234,7 @@
self.cookie='/'.join(self.getPhysicalPath())
def manage_beforeDelete(self, item, container):
+ import Globals
if self.nonempty():
raise VersionException(
'Attempt to %sdelete a non-empty version.<br />' %
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PageTemplates/PageTemplateFile.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PageTemplates/PageTemplateFile.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,8 +14,11 @@
import os
from logging import getLogger
-import AccessControl
-from Globals import package_home, InitializeClass, DevelopmentMode
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from App.class_init import default__class_init__ as InitializeClass
+from App.Common import package_home
+from App.special_dtml import DTMLFile
from App.config import getConfiguration
from Acquisition import aq_parent, aq_inner, aq_get
from ComputedAttribute import ComputedAttribute
@@ -60,7 +63,7 @@
_default_bindings = {'name_subpath': 'traverse_subpath'}
- security = AccessControl.ClassSecurityInfo()
+ security = ClassSecurityInfo()
security.declareProtected('View management screens',
'read', 'document_src')
@@ -118,7 +121,7 @@
response.setHeader('content-type', self.content_type)
# Execute the template in a new security context.
- security = AccessControl.getSecurityManager()
+ security = getSecurityManager()
bound_names['user'] = security.getUser()
security.addContext(self)
@@ -138,7 +141,8 @@
return self.__name__ # Don't reveal filesystem paths
def _cook_check(self):
- if self._v_last_read and not DevelopmentMode:
+ import Globals
+ if self._v_last_read and not Globals.DevelopmentMode:
return
__traceback_info__ = self.filename
try:
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PageTemplates/ZopePageTemplate.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,25 +14,30 @@
$Id$
"""
+import os
import re
-import os
-import Acquisition
+
+from AccessControl.Permissions import change_page_templates
+from AccessControl.Permissions import ftp_access
+from AccessControl.Permissions import view
+from AccessControl.Permissions import view_management_screens
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.ZopeGuards import safe_builtins
+from Acquisition import Acquired
+from Acquisition import Explicit
from Acquisition import aq_get
-from Globals import ImageFile, package_home, InitializeClass
+from App.class_init import default__class_init__ as InitializeClass
+from App.Common import package_home
+from App.ImageFile import ImageFile
from DateTime.DateTime import DateTime
-from Shared.DC.Scripts.Script import Script
-from Shared.DC.Scripts.Signature import FuncCode
-
from OFS.SimpleItem import SimpleItem
from OFS.History import Historical, html_diff
from OFS.Cache import Cacheable
from OFS.Traversable import Traversable
from OFS.PropertyManager import PropertyManager
-
-from AccessControl import getSecurityManager, safe_builtins, ClassSecurityInfo
-from AccessControl.Permissions import view, ftp_access, change_page_templates
-from AccessControl.Permissions import view_management_screens
-
+from Shared.DC.Scripts.Script import Script
+from Shared.DC.Scripts.Signature import FuncCode
from webdav.Lockable import ResourceLockedError
from Products.PageTemplates.PageTemplate import PageTemplate
@@ -40,9 +45,9 @@
from Products.PageTemplates.PageTemplateFile import guess_type
from Products.PageTemplates.Expressions import SecureModuleImporter
-from Products.PageTemplates.utils import encodingFromXMLPreamble, \
- charsetFromMetaEquiv, convertToUnicode
-
+from Products.PageTemplates.utils import encodingFromXMLPreamble
+from Products.PageTemplates.utils import charsetFromMetaEquiv
+from Products.PageTemplates.utils import convertToUnicode
preferred_encodings = ['utf-8', 'iso-8859-15']
if os.environ.has_key('ZPT_PREFERRED_ENCODING'):
@@ -50,10 +55,10 @@
-class Src(Acquisition.Explicit):
+class Src(Explicit):
""" I am scary code """
- PUT = document_src = Acquisition.Acquired
+ PUT = document_src = Acquired
index_html = None
def __before_publishing_traverse__(self, ob, request):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -20,12 +20,15 @@
from datetime import date, datetime
from datetime import tzinfo, timedelta
-import BTrees.Length
-from BTrees.IIBTree import IISet, union, intersection, multiunion
+from App.special_dtml import DTMLFile
+from BTrees.IIBTree import IISet
+from BTrees.IIBTree import union
+from BTrees.IIBTree import intersection
+from BTrees.IIBTree import multiunion
from BTrees.IOBTree import IOBTree
+from BTrees.Length import Length
from BTrees.OIBTree import OIBTree
from DateTime.DateTime import DateTime
-from Globals import DTMLFile
from OFS.PropertyManager import PropertyManager
from ZODB.POSException import ConflictError
from zope.interface import implements
@@ -110,7 +113,7 @@
""" Complete reset """
self._index = IOBTree()
self._unindex = OIBTree()
- self._length = BTrees.Length.Length()
+ self._length = Length()
def index_object( self, documentId, obj, threshold=None ):
"""index an object, normalizing the indexed value to an integer
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,12 +17,18 @@
import os
-from AccessControl import ClassSecurityInfo
-from BTrees.IIBTree import IISet, IITreeSet, union, intersection, multiunion
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from App.class_init import default__class_init__ as InitializeClass
+from App.Common import package_home
+from App.special_dtml import DTMLFile
+from BTrees.IIBTree import IISet
+from BTrees.IIBTree import IITreeSet
+from BTrees.IIBTree import intersection
+from BTrees.IIBTree import multiunion
+from BTrees.IIBTree import union
from BTrees.IOBTree import IOBTree
-import BTrees.Length
+from BTrees.Length import Length
from DateTime.DateTime import DateTime
-from Globals import package_home, DTMLFile, InitializeClass
from zope.interface import implements
from Products.PluginIndexes.common import safe_callable
@@ -125,7 +131,7 @@
self._since = IOBTree()
self._until = IOBTree()
self._unindex = IOBTree() # 'datum' will be a tuple of date ints
- self._length = BTrees.Length.Length()
+ self._length = Length()
#
# PluggableIndexInterface implementation (XXX inherit assertions?)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/FieldIndex/FieldIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/FieldIndex/FieldIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/FieldIndex/FieldIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,7 +15,7 @@
$Id$
"""
-from Globals import DTMLFile
+from App.special_dtml import DTMLFile
from Products.PluginIndexes.common.UnIndex import UnIndex
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/KeywordIndex/KeywordIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/KeywordIndex/KeywordIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/KeywordIndex/KeywordIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,11 +15,11 @@
$Id$
"""
-from types import StringType, UnicodeType
from logging import getLogger
-from BTrees.OOBTree import OOSet, difference
-from Globals import DTMLFile
+from BTrees.OOBTree import difference
+from BTrees.OOBTree import OOSet
+from App.special_dtml import DTMLFile
from Products.PluginIndexes.common import safe_callable
from Products.PluginIndexes.common.UnIndex import UnIndex
@@ -95,8 +95,7 @@
newKeywords = getattr(obj, attr, ())
if safe_callable(newKeywords):
newKeywords = newKeywords()
- if (isinstance(newKeywords, StringType)
- or isinstance(newKeywords, UnicodeType)): #Python 2.1 compat isinstance
+ if isinstance(newKeywords, basestring): #Python 2.1 compat isinstance
return (newKeywords,)
else:
unique = {}
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,12 +17,17 @@
from logging import getLogger
-from Globals import Persistent, DTMLFile
+from App.special_dtml import DTMLFile
from OFS.SimpleItem import SimpleItem
+from BTrees.IIBTree import IITreeSet
+from BTrees.IIBTree import IISet
+from BTrees.IIBTree import intersection
+from BTrees.IIBTree import multiunion
+from BTrees.IIBTree import union
from BTrees.IOBTree import IOBTree
from BTrees.OOBTree import OOBTree
-from BTrees.IIBTree import IITreeSet, IISet, intersection, union, multiunion
from BTrees.Length import Length
+from Persistence import Persistent
from zope.interface import implements
from Products.PluginIndexes.common import safe_callable
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/GlobbingLexicon.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/TextIndex/GlobbingLexicon.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/GlobbingLexicon.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -10,23 +10,20 @@
# FOR A PARTICULAR PURPOSE
#
#############################################################################
+import re
+import string
-from Lexicon import Lexicon
-import Splitter
-
-import re, string
-
from BTrees.IIBTree import IISet, union, IITreeSet
from BTrees.OIBTree import OIBTree
from BTrees.IOBTree import IOBTree
from BTrees.OOBTree import OOBTree
-
-from Products.PluginIndexes.TextIndex.TextIndex import Or,Op
from Products.PluginIndexes.common.randid import randid
+from Products.PluginIndexes.TextIndex.TextIndex import Op
+from Products.PluginIndexes.TextIndex.TextIndex import Or
+from Products.PluginIndexes.TextIndex.Lexicon import Lexicon
+from Products.PluginIndexes.TextIndex.Splitter import getSplitter
-from types import UnicodeType
-
class GlobbingLexicon(Lexicon):
"""Lexicon which supports basic globbing function ('*' and '?').
@@ -59,7 +56,7 @@
self.clear()
self.useSplitter = useSplitter
self.splitterParams = extra
- self.SplitterFunc = Splitter.getSplitter(self.useSplitter)
+ self.SplitterFunc = getSplitter(self.useSplitter)
def clear(self):
self._lexicon = OIBTree()
@@ -253,7 +250,7 @@
"""
# Remove characters that are meaningful in a regex
- if not isinstance(pat, UnicodeType):
+ if not isinstance(pat, unicode):
transTable = string.maketrans("", "")
result = string.translate(pat, transTable,
r'()&|!@#$%^{}\<>.')
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/Lexicon.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/TextIndex/Lexicon.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/Lexicon.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,14 +17,15 @@
"""
-import Splitter
-from Persistence import Persistent
from Acquisition import Implicit
-
from BTrees.OIBTree import OIBTree
from BTrees.IOBTree import IOBTree
-from BTrees.IIBTree import IISet, IITreeSet
+from BTrees.IIBTree import IISet
+from BTrees.IIBTree import IITreeSet
+from Persistence import Persistent
from Products.PluginIndexes.common.randid import randid
+from Products.PluginIndexes.TextIndex.Splitter import getSplitter
+from Products.PluginIndexes.TextIndex.Splitter import splitterNames
from types import StringType
@@ -49,10 +50,10 @@
else:
self.stop_syn = stop_syn
- self.useSplitter = Splitter.splitterNames[0]
+ self.useSplitter = splitterNames[0]
if useSplitter: self.useSplitter=useSplitter
self.splitterParams = extra
- self.SplitterFunc = Splitter.getSplitter(self.useSplitter)
+ self.SplitterFunc = getSplitter(self.useSplitter)
def clear(self):
@@ -126,12 +127,11 @@
while not inverse.insert(wid, word):
wid=randid()
- if isinstance(word,StringType):
+ if isinstance(word, str):
self._lexicon[intern(word)] = wid
else:
self._lexicon[word] = wid
-
return wid
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,19 +15,25 @@
$Id$
"""
-import operator, warnings
-import re
from cgi import escape
-from types import *
from logging import getLogger
-from Globals import Persistent, DTMLFile
+import operator
+import re
+import warnings
+from types import *
+
from Acquisition import Implicit
+from App.special_dtml import DTMLFile
from OFS.SimpleItem import SimpleItem
+from BTrees.IIBTree import difference
+from BTrees.IIBTree import IIBTree
+from BTrees.IIBTree import IIBucket
+from BTrees.IIBTree import IISet
+from BTrees.IIBTree import weightedIntersection
from BTrees.IOBTree import IOBTree
-from BTrees.IIBTree import IIBTree, IIBucket, IISet
-from BTrees.IIBTree import difference, weightedIntersection
from BTrees.OIBTree import OIBTree
+from Persistence import Persistent
from zope.interface import implements
from Products.PluginIndexes.common import safe_callable
@@ -35,9 +41,8 @@
from Products.PluginIndexes.common.util import parseIndexRequest
from Products.PluginIndexes.interfaces import IPluggableIndex
from Products.PluginIndexes.interfaces import ITextIndex
+from Products.PluginIndexes.TextIndex.Lexicon import Lexicon
-from Lexicon import Lexicon
-
LOG = getLogger('TextIndex')
class Op:
@@ -178,9 +183,10 @@
self._index=IOBTree()
def convertScores(scores,
- type=type, TupleType=TupleType, IIBTree=IIBTree
+ type=type,
+ IIBTree=IIBTree
):
- if type(scores) is not TupleType and type(scores) is not IIBTree():
+ if type(scores) is not tuple and type(scores) is not IIBTree():
scores=IIBTree(scores)
return scores
@@ -190,14 +196,16 @@
self._unindex=IOBTree()
convert(_unindex, self._unindex, threshold)
- def histogram(self, type=type, TupleType=type(())):
+ def histogram(self, type=type):
"""Return a mapping which provides a histogram of the number of
elements found at each point in the index."""
histogram = IIBucket()
for (key, value) in self._index.items():
- if type(value) is TupleType: entry=1
- else: entry = len(value)
+ if type(value) is tuple:
+ entry = 1
+ else:
+ entry = len(value)
histogram[entry] = histogram.get(entry, 0) + 1
return histogram
@@ -230,7 +238,7 @@
indexRow = index.get(entry, None)
if indexRow is not None:
- if type(indexRow) is TupleType:
+ if type(indexRow) is tuple:
# Tuples are only used for rows which have only
# a single entry. Since we now need more, we'll
# promote it to a mapping object (dictionary).
@@ -251,7 +259,7 @@
if indexRow.get(documentId, -1) != score:
# score changed (or new entry)
- if type(indexRow) is DictType:
+ if type(indexRow) is dict:
indexRow[documentId] = score
if len(indexRow) > 3:
# Big enough to give it's own database record
@@ -281,7 +289,7 @@
if safe_callable(source):
source = source()
- if not isinstance(source, UnicodeType):
+ if not isinstance(source, unicode):
source = str(source)
except (AttributeError, TypeError):
@@ -376,13 +384,13 @@
LOG.error('unindex_object tried to unindex nonexistent'
' document, wid %s, %s' % (i,wid))
continue
- if type(widScores) is TupleType:
+ if type(widScores) is tuple:
del index[wid]
else:
try:
del widScores[i]
if widScores:
- if type(widScores) is DictType:
+ if type(widScores) is dict:
if len(widScores) == 1:
# convert to tuple
widScores = widScores.items()[0]
@@ -563,17 +571,17 @@
operandType = type(left)
if operandType is IntType:
left = self[left]
- elif isinstance(left,StringType) or isinstance(left,UnicodeType):
+ elif isinstance(left,str) or isinstance(left,unicode):
left = self[left]
- elif operandType is ListType:
+ elif operandType is list:
left = self.evaluate(left)
operandType = type(right)
if operandType is IntType:
right = self[right]
- elif isinstance(right,StringType) or isinstance(right,UnicodeType):
+ elif isinstance(right,str) or isinstance(right,unicode):
right = self[right]
- elif operandType is ListType:
+ elif operandType is list:
right = self.evaluate(right)
return (left, right)
@@ -581,11 +589,11 @@
def evaluate(self, query):
"""Evaluate a parsed query"""
# Strip off meaningless layers
- while isinstance(query, ListType) and len(query) == 1:
+ while isinstance(query, list) and len(query) == 1:
query = query[0]
# If it's not a list, assume a string or number
- if not isinstance(query, ListType):
+ if not isinstance(query, list):
return self[query]
# Now we need to loop through the query and reduce
@@ -676,7 +684,7 @@
i = 0
while i < len(q):
e = q[i]
- if isinstance(e, ListType):
+ if isinstance(e, list):
q[i] = parse2(e, default_operator)
if i % 2:
q.insert(i, default_operator)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/Vocabulary.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/TextIndex/Vocabulary.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TextIndex/Vocabulary.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,13 +15,14 @@
$Id$
"""
-from Globals import DTMLFile, MessageDialog
-import AccessControl.Role
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import manage_vocabulary
from AccessControl.Permissions import query_vocabulary
+from AccessControl.Role import RoleManager
+from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
from Persistence import Persistent
from OFS.SimpleItem import Item
from zope.interface import implements
@@ -49,7 +50,7 @@
class _extra: pass
-class Vocabulary(Item, Persistent, Implicit, AccessControl.Role.RoleManager):
+class Vocabulary(Item, Persistent, Implicit, RoleManager):
"""A Vocabulary is a user-managable realization of a Lexicon object.
"""
@@ -70,8 +71,8 @@
{'label': 'Query', 'action': 'manage_query',
'help': ('ZCatalog', 'Vocabulary_Query.stx')},
)
- +Item.manage_options
- +AccessControl.Role.RoleManager.manage_options
+ + Item.manage_options
+ + RoleManager.manage_options
)
security.declareProtected(manage_vocabulary, 'manage_main')
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TopicIndex/FilteredSet.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/TopicIndex/FilteredSet.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TopicIndex/FilteredSet.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,14 +14,13 @@
$Id$
"""
-
-import sys
from logging import getLogger
+import sys
-from ZODB.POSException import ConflictError
from BTrees.IIBTree import IITreeSet
from Persistence import Persistent
from RestrictedPython.Eval import RestrictionCapableEval
+from ZODB.POSException import ConflictError
from zope.interface import implements
from Products.PluginIndexes.interfaces import IFilteredSet
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TopicIndex/TopicIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/TopicIndex/TopicIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/TopicIndex/TopicIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,17 +17,20 @@
from logging import getLogger
-from Globals import Persistent, DTMLFile
+from App.special_dtml import DTMLFile
+from BTrees.IIBTree import IITreeSet
+from BTrees.IIBTree import intersection
+from BTrees.IIBTree import union
+from BTrees.OOBTree import OOBTree
from OFS.SimpleItem import SimpleItem
-from BTrees.OOBTree import OOBTree
-from BTrees.IIBTree import IITreeSet,intersection,union
+from Persistence import Persistent
from zope.interface import implements
from Products.PluginIndexes.common.util import parseIndexRequest
from Products.PluginIndexes.interfaces import IPluggableIndex
from Products.PluginIndexes.interfaces import ITopicIndex
-import FilteredSet
+from Products.PluginIndexes.TopicIndex.FilteredSet import factory
_marker = []
LOG = getLogger('Zope.TopicIndex')
@@ -125,8 +128,10 @@
if self.filteredSets.has_key(filter_id):
raise KeyError,\
'A FilteredSet with this name already exists: %s' % filter_id
- self.filteredSets[filter_id] = \
- FilteredSet.factory(filter_id, typeFilteredSet, expr)
+ self.filteredSets[filter_id] = factory(filter_id,
+ typeFilteredSet,
+ expr,
+ )
def delFilteredSet(self, filter_id):
# Delete the FilteredSet object specified by 'filter_id'.
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/__init__.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/__init__.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/__init__.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -11,9 +11,6 @@
#
##############################################################################
-import common.ResultList as ResultList
-import common.UnIndex as UnIndex
-
import PathIndex.PathIndex
import FieldIndex.FieldIndex
import KeywordIndex.KeywordIndex
@@ -21,6 +18,9 @@
import DateIndex.DateIndex
import DateRangeIndex.DateRangeIndex
+from Products.PluginIndexes.common import ResultList
+from Products.PluginIndexes.common import UnIndex
+
# BBB: TextIndex is deprecated but we don't want the warning to appear here
import warnings
warnings.filterwarnings('ignore', message='^Using TextIndex', append=1)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/common/ResultList.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/common/ResultList.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/common/ResultList.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -11,19 +11,23 @@
#
##############################################################################
+from BTrees.IIBTree import difference
from BTrees.IIBTree import IIBucket
-from BTrees.IIBTree import weightedIntersection, weightedUnion, difference
-from BTrees.OOBTree import OOSet, union
+from BTrees.IIBTree import weightedIntersection
+from BTrees.IIBTree import weightedUnion
+from BTrees.OOBTree import OOSet
+from BTrees.OOBTree import union
class ResultList:
- def __init__(self, d, words, index, TupleType=type(())):
+ def __init__(self, d, words, index):
self._index = index
- if type(words) is not OOSet: words=OOSet(words)
+ if type(words) is not OOSet:
+ words=OOSet(words)
self._words = words
- if (type(d) is TupleType):
+ if (type(d) is tuple):
d = IIBucket((d,))
elif type(d) is not IIBucket:
d = IIBucket(d)
@@ -37,13 +41,17 @@
def __nonzero__(self):
return not not self._dict
- def bucket(self): return self._dict
+ def bucket(self):
+ return self._dict
- def keys(self): return self._dict.keys()
+ def keys(self):
+ return self._dict.keys()
- def has_key(self, key): return self._dict.has_key(key)
+ def has_key(self, key):
+ return self._dict.has_key(key)
- def items(self): return self._dict.items()
+ def items(self):
+ return self._dict.items()
def __and__(self, x):
return self.__class__(
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/common/UnIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/common/UnIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/common/UnIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,14 +14,16 @@
$Id$
"""
-
-import sys
from cgi import escape
from logging import getLogger
+import sys
-from BTrees.IIBTree import IITreeSet, IISet, union, intersection
+from BTrees.IIBTree import intersection
+from BTrees.IIBTree import IITreeSet
+from BTrees.IIBTree import IISet
+from BTrees.IIBTree import union
from BTrees.IOBTree import IOBTree
-import BTrees.Length
+from BTrees.Length import Length
from BTrees.OOBTree import OOBTree
from OFS.SimpleItem import SimpleItem
from ZODB.POSException import ConflictError
@@ -109,7 +111,7 @@
if not self.indexed_attrs:
self.indexed_attrs = [id]
- self._length = BTrees.Length.Length()
+ self._length = Length()
self.clear()
def __len__(self):
@@ -119,7 +121,7 @@
return self.id
def clear(self):
- self._length = BTrees.Length.Length()
+ self._length = Length()
self._index = OOBTree()
self._unindex = IOBTree()
@@ -177,7 +179,7 @@
# XXX swallow KeyError because it was probably
# removed and then _length AttributeError raised
pass
- if isinstance(self.__len__, BTrees.Length.Length):
+ if isinstance(self.__len__, Length):
self._length = self.__len__
del self.__len__
self._length.change(-1)
@@ -210,7 +212,7 @@
try:
self._length.change(1)
except AttributeError:
- if isinstance(self.__len__, BTrees.Length.Length):
+ if isinstance(self.__len__, Length):
self._length = self.__len__
del self.__len__
self._length.change(1)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/common/util.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/common/util.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PluginIndexes/common/util.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,12 +14,12 @@
$Id$
"""
-
+from types import InstanceType
from warnings import warn
-from types import InstanceType
-from DateTime import DateTime
+from DateTime.DateTime import DateTime
+
class parseIndexRequest:
"""
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PythonScripts/PythonScript.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -16,27 +16,38 @@
This product provides support for Script objects containing restricted
Python code.
"""
-
__version__='$Revision: 1.56 $'[11:-2]
-import sys, os, traceback, re, marshal, new
from logging import getLogger
-from Globals import DTMLFile, MessageDialog, package_home
-import AccessControl, OFS, RestrictedPython
+import marshal
+import new
+import os
+import re
+import sys
+import traceback
+from urllib import quote
+
+from AccessControl.requestmethod import requestmethod
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr
+from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr
from Acquisition import aq_parent
+from App.class_init import default__class_init__ as InitializeClass
+from App.Common import package_home
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
+from DateTime.DateTime import DateTime
+from OFS.Cache import Cacheable
+from OFS.History import Historical
+from OFS.History import html_diff
from OFS.SimpleItem import SimpleItem
-from DateTime.DateTime import DateTime
-from urllib import quote
+from RestrictedPython import compile_restricted_function
+from Shared.DC.Scripts.Script import BindingsUI
+from Shared.DC.Scripts.Script import defaultBindings
+from Shared.DC.Scripts.Script import Script
from webdav.Lockable import ResourceLockedError
-from Shared.DC.Scripts.Script import Script, BindingsUI, defaultBindings
-from AccessControl import getSecurityManager
-from OFS.History import Historical, html_diff
-from OFS.Cache import Cacheable
-from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr
-from AccessControl.requestmethod import requestmethod
-
from zExceptions import Forbidden
-import Globals
LOG = getLogger('PythonScripts')
@@ -111,7 +122,7 @@
self.ZBindings_edit(defaultBindings)
self._makeFunction()
- security = AccessControl.ClassSecurityInfo()
+ security = ClassSecurityInfo()
security.declareObjectProtected('View')
security.declareProtected('View', '__call__')
@@ -225,7 +236,7 @@
self._newfun(marshal.loads(self._code))
def _compiler(self, *args, **kw):
- return RestrictedPython.compile_restricted_function(*args, **kw)
+ return compile_restricted_function(*args, **kw)
def _compile(self):
bind_names = self.getBindingAssignments().getAssignedNamesInOrder()
@@ -509,7 +520,7 @@
return self.read()
-Globals.InitializeClass(PythonScript)
+InitializeClass(PythonScript)
class PythonScriptTracebackSupplement:
"""Implementation of ITracebackSupplement"""
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/PythonScripts/standard.py
===================================================================
--- Zope/trunk/lib/python/Products/PythonScripts/standard.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/PythonScripts/standard.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,28 +17,47 @@
Scripts. It can be accessed from Python with the statement
"import Products.PythonScripts.standard"
"""
-
__version__='$Revision: 1.14 $'[11:-2]
-from AccessControl import ModuleSecurityInfo, getSecurityManager
+from urllib import urlencode
+
+from AccessControl.DTML import RestrictedDTML
+from AccessControl.SecurityInfo import ModuleSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from App.special_dtml import HTML
+from DocumentTemplate.DT_Var import special_formats
+from DocumentTemplate.DT_Var import whole_dollars
+from DocumentTemplate.DT_Var import dollars_and_cents
+from DocumentTemplate.DT_Var import structured_text
+from DocumentTemplate.DT_Var import sql_quote
+from DocumentTemplate.DT_Var import html_quote
+from DocumentTemplate.DT_Var import url_quote
+from DocumentTemplate.DT_Var import url_quote_plus
+from DocumentTemplate.DT_Var import newline_to_br
+from DocumentTemplate.DT_Var import thousands_commas
+from DocumentTemplate.DT_Var import url_unquote
+from DocumentTemplate.DT_Var import url_unquote_plus
+from DocumentTemplate.DT_Var import restructured_text
+from ZPublisher.HTTPRequest import record
+
security = ModuleSecurityInfo()
-security.declarePublic('special_formats', 'whole_dollars',
- 'dollars_and_cents', 'structured_text',
+security.declarePublic('special_formats',
+ 'whole_dollars',
+ 'dollars_and_cents',
+ 'structured_text',
'restructured_text',
- 'sql_quote', 'html_quote', 'url_quote',
- 'url_quote_plus', 'newline_to_br',
- 'thousands_commas', 'url_unquote',
- 'url_unquote_plus', 'urlencode')
-from DocumentTemplate.DT_Var import special_formats, \
- whole_dollars, dollars_and_cents, structured_text, sql_quote, \
- html_quote, url_quote, url_quote_plus, newline_to_br, thousands_commas, \
- url_unquote, url_unquote_plus, restructured_text
-from urllib import urlencode
+ 'sql_quote',
+ 'html_quote',
+ 'url_quote',
+ 'url_quote_plus',
+ 'newline_to_br',
+ 'thousands_commas',
+ 'url_unquote',
+ 'url_unquote_plus',
+ 'urlencode',
+ )
-from Globals import HTML
-from AccessControl.DTML import RestrictedDTML
-
security.declarePublic('DTML')
class DTML(RestrictedDTML, HTML):
"""DTML objects are DocumentTemplate.HTML objects that allow
@@ -54,10 +73,7 @@
finally: security.removeContext(self)
-from ZPublisher.HTTPRequest import record
-security.declarePublic('Object')
-
# We don't expose classes directly to restricted code
class _Object(record):
_guarded_writes = 1
@@ -85,6 +101,7 @@
def __hash__(self):
return id(self)
+security.declarePublic('Object')
def Object(**kw):
return _Object(**kw)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/Sessions/BrowserIdManager.py
===================================================================
--- Zope/trunk/lib/python/Products/Sessions/BrowserIdManager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/Sessions/BrowserIdManager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -10,30 +10,46 @@
# FOR A PARTICULAR PURPOSE
#
############################################################################
+__version__='$Revision: 1.20 $'[11:-2]
-__version__='$Revision: 1.20 $'[11:-2]
-import Globals
-from Persistence import Persistent
-from persistent import TimeStamp
-from Acquisition import Implicit, aq_base, aq_parent, aq_inner
+import binascii
+from cgi import escape
+import logging
+import random
+import re
+import string
+import sys
+import time
+from urllib import quote
+from urlparse import urlparse
+from urlparse import urlunparse
+
from AccessControl.Owned import Owned
from AccessControl.Role import RoleManager
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Implicit
+from Acquisition import aq_base
+from Acquisition import aq_parent
+from Acquisition import aq_inner
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
from App.Management import Tabs
+from App.special_dtml import DTMLFile
+from Persistence import Persistent
+from persistent import TimeStamp
from OFS.SimpleItem import Item
from OFS.ObjectManager import UNIQUE
-from AccessControl import ClassSecurityInfo
-import SessionInterfaces
-from SessionPermissions import *
-from common import DEBUG
-import os, time, random, string, binascii, sys, re
-from cgi import escape
-from urllib import quote
-from urlparse import urlparse, urlunparse
-from ZPublisher.BeforeTraverse import registerBeforeTraverse, \
- unregisterBeforeTraverse, queryBeforeTraverse
-import logging
+from ZPublisher.BeforeTraverse import registerBeforeTraverse
+from ZPublisher.BeforeTraverse import unregisterBeforeTraverse
+from ZPublisher.BeforeTraverse import queryBeforeTraverse
from zope.interface import implements
+from Products.Sessions.SessionInterfaces import BrowserIdManagerInterface
+from Products.Sessions.SessionPermissions import ACCESS_CONTENTS_PERM
+from Products.Sessions.SessionPermissions import CHANGE_IDMGR_PERM
+from Products.Sessions.SessionPermissions import MGMT_SCREEN_PERM
+from Products.Sessions.common import DEBUG
+
b64_trans = string.maketrans('+/', '-.')
b64_untrans = string.maketrans('-.', '+/')
@@ -43,7 +59,7 @@
_marker = []
-constructBrowserIdManagerForm = Globals.DTMLFile('dtml/addIdManager',globals())
+constructBrowserIdManagerForm = DTMLFile('dtml/addIdManager', globals())
BROWSERID_MANAGER_NAME = 'browser_id_manager'# imported by SessionDataManager
ALLOWED_BID_NAMESPACES = ('form', 'cookies', 'url')
@@ -81,7 +97,7 @@
{'label': 'Ownership', 'action':'manage_owner'}
)
- implements(SessionInterfaces.BrowserIdManagerInterface)
+ implements(BrowserIdManagerInterface)
icon = 'misc_/Sessions/idmgr.gif'
@@ -256,7 +272,7 @@
return urlunparse((proto, host, path, params, query, frag))
security.declareProtected(MGMT_SCREEN_PERM, 'manage_browseridmgr')
- manage_browseridmgr = Globals.DTMLFile('dtml/manageIdManager', globals())
+ manage_browseridmgr = DTMLFile('dtml/manageIdManager', globals())
security.declareProtected(CHANGE_IDMGR_PERM,
'manage_changeBrowserIdManager')
@@ -428,7 +444,7 @@
def _setId(self, id):
if id != self.id:
- raise Globals.MessageDialog(
+ raise MessageDialog(
title='Cannot rename',
message='You cannot rename a browser id manager, sorry!',
action ='./manage_main',)
@@ -553,4 +569,4 @@
return '%08i%s' % (randint(0, maxint-1), getB64TStamp())
-Globals.InitializeClass(BrowserIdManager)
+InitializeClass(BrowserIdManager)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/Sessions/SessionDataManager.py
===================================================================
--- Zope/trunk/lib/python/Products/Sessions/SessionDataManager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/Sessions/SessionDataManager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -11,32 +11,44 @@
#
############################################################################
-import re, time, sys
from logging import getLogger
-import Globals
-from OFS.SimpleItem import Item
-from ZODB.POSException import ConflictError
-from Acquisition import Implicit, Explicit, aq_base
-from Persistence import Persistent
+import re
+import sys
+import time
+
from AccessControl.Owned import Owned
from AccessControl.Role import RoleManager
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Implicit
+from Acquisition import Explicit
+from Acquisition import aq_base
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
from App.Management import Tabs
-from AccessControl import ClassSecurityInfo
-import SessionInterfaces
-from SessionPermissions import *
-from common import DEBUG
-from BrowserIdManager import isAWellFormedBrowserId, getNewBrowserId,\
- BROWSERID_MANAGER_NAME
-from ZPublisher.BeforeTraverse import registerBeforeTraverse, \
- unregisterBeforeTraverse
+from OFS.SimpleItem import Item
+from Persistence import Persistent
+from ZPublisher.BeforeTraverse import registerBeforeTraverse
+from ZPublisher.BeforeTraverse import unregisterBeforeTraverse
+from ZODB.POSException import ConflictError
from zope.interface import implements
+from Products.Sessions.SessionInterfaces import SessionDataManagerInterface
+from Products.Sessions.SessionPermissions import ACCESS_CONTENTS_PERM
+from Products.Sessions.SessionPermissions import ACCESS_SESSIONDATA_PERM
+from Products.Sessions.SessionPermissions import ARBITRARY_SESSIONDATA_PERM
+from Products.Sessions.SessionPermissions import CHANGE_DATAMGR_PERM
+from Products.Sessions.SessionPermissions import MGMT_SCREEN_PERM
+from Products.Sessions.common import DEBUG
+from Products.Sessions.BrowserIdManager import isAWellFormedBrowserId
+from Products.Sessions.BrowserIdManager import getNewBrowserId
+from Products.Sessions.BrowserIdManager import BROWSERID_MANAGER_NAME
+
bad_path_chars_in=re.compile('[^a-zA-Z0-9-_~\,\. \/]').search
LOG = getLogger('SessionDataManager')
class SessionDataManagerErr(Exception): pass
-constructSessionDataManagerForm = Globals.DTMLFile('dtml/addDataManager',
+constructSessionDataManagerForm = DTMLFile('dtml/addDataManager',
globals())
ADD_SESSION_DATAMANAGER_PERM="Add Session Data Manager"
@@ -81,9 +93,9 @@
icon='misc_/CoreSessionTracking/datamgr.gif'
- implements(SessionInterfaces.SessionDataManagerInterface)
+ implements(SessionDataManagerInterface)
- manage_sessiondatamgr = Globals.DTMLFile('dtml/manageDataManager',
+ manage_sessiondatamgr = DTMLFile('dtml/manageDataManager',
globals())
# INTERFACE METHODS FOLLOW
@@ -293,4 +305,4 @@
request.set_lazy(self._requestSessionName, getSessionData)
-Globals.InitializeClass(SessionDataManager)
+InitializeClass(SessionDataManager)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteAccess/AccessRule.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteAccess/AccessRule.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteAccess/AccessRule.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -2,14 +2,16 @@
Provide a simple method to set up Access Rules
"""
-
-from Globals import DTMLFile, MessageDialog
-from ZPublisher.BeforeTraverse import \
- registerBeforeTraverse, unregisterBeforeTraverse, queryBeforeTraverse, \
- NameCaller
+from cgi import escape
import os
-from cgi import escape
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
+from ZPublisher.BeforeTraverse import NameCaller
+from ZPublisher.BeforeTraverse import queryBeforeTraverse
+from ZPublisher.BeforeTraverse import registerBeforeTraverse
+from ZPublisher.BeforeTraverse import unregisterBeforeTraverse
+
SUPPRESS_ACCESSRULE = os.environ.has_key('SUPPRESS_ACCESSRULE')
class AccessRule(NameCaller):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteAccess/SiteRoot.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteAccess/SiteRoot.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteAccess/SiteRoot.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -2,16 +2,21 @@
Defines the Traverser base class and SiteRoot class
"""
+from cgi import escape
+import os
-from Globals import DTMLFile, MessageDialog, Persistent
+from Acquisition import Implicit
+from Acquisition import ImplicitAcquisitionWrapper
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
+from ExtensionClass import Base
from OFS.SimpleItem import Item
-from Acquisition import Implicit, ImplicitAcquisitionWrapper
-from ExtensionClass import Base
-from ZPublisher import BeforeTraverse
-import os
-from cgi import escape
+from Persistence import Persistent
+from ZPublisher.BeforeTraverse import NameCaller
+from ZPublisher.BeforeTraverse import registerBeforeTraverse
+from ZPublisher.BeforeTraverse import unregisterBeforeTraverse
-from AccessRule import _swallow
+from Products.SiteAccess.AccessRule import _swallow
SUPPRESS_SITEROOT = os.environ.has_key('SUPPRESS_SITEROOT')
@@ -44,7 +49,7 @@
def manage_beforeDelete(self, item, container):
if item is self:
- BeforeTraverse.unregisterBeforeTraverse(container, self.meta_type)
+ unregisterBeforeTraverse(container, self.meta_type)
def manage_afterAdd(self, item, container):
if item is self:
@@ -53,8 +58,8 @@
# We want the original object, not stuff in between
container = container.this()
- hook = BeforeTraverse.NameCaller(id)
- BeforeTraverse.registerBeforeTraverse(container, hook,
+ hook = NameCaller(id)
+ registerBeforeTraverse(container, hook,
self.meta_type,
self.priority)
def _setId(self, id):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteAccess/VirtualHostMonster.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteAccess/VirtualHostMonster.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteAccess/VirtualHostMonster.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -2,17 +2,24 @@
Defines the VirtualHostMonster class
"""
+import os
-from Globals import DTMLFile, MessageDialog, Persistent
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import view as View
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import aq_inner
+from Acquisition import aq_parent
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
from OFS.SimpleItem import Item
-from Acquisition import Implicit, aq_inner, aq_parent
-from ZPublisher import BeforeTraverse
+from Persistence import Persistent
+from ZPublisher.BeforeTraverse import NameCaller
+from ZPublisher.BeforeTraverse import queryBeforeTraverse
+from ZPublisher.BeforeTraverse import registerBeforeTraverse
+from ZPublisher.BeforeTraverse import unregisterBeforeTraverse
from ZPublisher.BaseRequest import quote
from zExceptions import BadRequest
-import os
from AccessRule import _swallow
@@ -117,11 +124,11 @@
def manage_beforeDelete(self, item, container):
if item is self:
- BeforeTraverse.unregisterBeforeTraverse(container, self.meta_type)
+ unregisterBeforeTraverse(container, self.meta_type)
def manage_afterAdd(self, item, container):
if item is self:
- if BeforeTraverse.queryBeforeTraverse(container,
+ if queryBeforeTraverse(container,
self.meta_type):
raise BadRequest, ('This container already has a %s' %
self.meta_type)
@@ -130,8 +137,8 @@
# We want the original object, not stuff in between
container = container.this()
- hook = BeforeTraverse.NameCaller(id)
- BeforeTraverse.registerBeforeTraverse(container, hook,
+ hook = NameCaller(id)
+ registerBeforeTraverse(container, hook,
self.meta_type,
self.priority)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteErrorLog/SiteErrorLog.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteErrorLog/SiteErrorLog.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/SiteErrorLog/SiteErrorLog.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -23,9 +23,12 @@
from random import random
from thread import allocate_lock
-import Globals
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.unauthorized import Unauthorized
from Acquisition import aq_base
-from AccessControl import ClassSecurityInfo, getSecurityManager, Unauthorized
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
from OFS.SimpleItem import SimpleItem
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zExceptions.ExceptionFormatter import format_exception
@@ -100,7 +103,7 @@
def _setId(self, id):
if id != self.id:
- raise Globals.MessageDialog(
+ raise MessageDialog(
title='Invalid Id',
message='Cannot change the id of a SiteErrorLog',
action ='./manage_main',)
@@ -294,7 +297,7 @@
RESPONSE.setHeader('Content-Type', 'text/plain')
return entry['tb_text']
-Globals.InitializeClass(SiteErrorLog)
+InitializeClass(SiteErrorLog)
def manage_addErrorLog(dispatcher, RESPONSE=None):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/StandardCacheManagers/AcceleratedHTTPCacheManager.py
===================================================================
--- Zope/trunk/lib/python/Products/StandardCacheManagers/AcceleratedHTTPCacheManager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/StandardCacheManagers/AcceleratedHTTPCacheManager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,22 +17,23 @@
$Id$
'''
-
-from OFS.Cache import Cache, CacheManager
-from OFS.SimpleItem import SimpleItem
+from cgi import escape
+import httplib
import logging
import socket
import time
-from Globals import InitializeClass
-from Globals import DTMLFile
-from AccessControl import ClassSecurityInfo
+from urllib import quote
+import urlparse
+
from AccessControl.Permissions import view_management_screens
-import urlparse, httplib
-from cgi import escape
-from urllib import quote
+from AccessControl.SecurityInfo import ClassSecurityInfo
from App.Common import rfc1123_date
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from OFS.Cache import Cache
+from OFS.Cache import CacheManager
+from OFS.SimpleItem import SimpleItem
-
logger = logging.getLogger('Zope.AcceleratedHTTPCacheManager')
class AcceleratedHTTPCache (Cache):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/StandardCacheManagers/RAMCacheManager.py
===================================================================
--- Zope/trunk/lib/python/Products/StandardCacheManagers/RAMCacheManager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/StandardCacheManagers/RAMCacheManager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -16,20 +16,24 @@
$Id$
'''
-
-
-from OFS.Cache import Cache, CacheManager
-from OFS.SimpleItem import SimpleItem
+from cgi import escape
from thread import allocate_lock
-from cgi import escape
import time
-from Globals import InitializeClass
-from Globals import DTMLFile
-from AccessControl import ClassSecurityInfo
+
from AccessControl.Permissions import view_management_screens
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from OFS.Cache import Cache
+from OFS.Cache import CacheManager
+from OFS.SimpleItem import SimpleItem
-try: from cPickle import Pickler, HIGHEST_PROTOCOL
-except: from pickle import Pickler, HIGHEST_PROTOCOL
+try:
+ from cPickle import Pickler
+ from cPickle import HIGHEST_PROTOCOL
+except ImportError:
+ from pickle import Pickler
+ from pickle import HIGHEST_PROTOCOL
_marker = [] # Create a new marker object.
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/Transience/Transience.py
===================================================================
--- Zope/trunk/lib/python/Products/Transience/Transience.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/Transience/Transience.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,38 +15,42 @@
$Id$
"""
-
+from cgi import escape
+from logging import getLogger
import math
-import time
+import os
import random
import sys
-import os
import thread
-from cgi import escape
+import time
-import Globals
-from Globals import HTMLFile
-from TransienceInterfaces import Transient, DictionaryLike, ItemWithId,\
- TTWDictionary, ImmutablyValuedMappingOfPickleableObjects,\
- StringKeyedHomogeneousItemContainer, TransientItemContainer
-
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.SecurityManagement import newSecurityManager
+from AccessControl.SecurityManagement import setSecurityManager
+from AccessControl.SpecialUsers import nobody
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import HTMLFile
from BTrees.Length import Length as BTreesLength
from BTrees.OOBTree import OOBTree
from BTrees.IOBTree import IOBTree
-
+from OFS.SimpleItem import SimpleItem
from Persistence import Persistent
-from OFS.SimpleItem import SimpleItem
-from AccessControl import ClassSecurityInfo, getSecurityManager
-from AccessControl.SecurityManagement import newSecurityManager, \
- setSecurityManager
-from AccessControl.User import nobody
-from logging import getLogger
-
from zope.interface import implements
-from TransientObject import TransientObject
-from Fake import FakeIOBTree
+from Products.Transience.TransienceInterfaces import DictionaryLike
+from Products.Transience.TransienceInterfaces \
+ import ImmutablyValuedMappingOfPickleableObjects
+from Products.Transience.TransienceInterfaces import ItemWithId
+from Products.Transience.TransienceInterfaces \
+ import StringKeyedHomogeneousItemContainer
+from Products.Transience.TransienceInterfaces import Transient
+from Products.Transience.TransienceInterfaces import TransientItemContainer
+from Products.Transience.TransienceInterfaces import TTWDictionary
+from Products.Transience.TransientObject import TransientObject
+from Products.Transience.Fake import FakeIOBTree
+
ADD_CONTAINER_PERM = 'Add Transient Object Container'
MGMT_SCREEN_PERM = 'View management screens'
ACCESS_CONTENTS_PERM = 'Access contents information'
@@ -1116,5 +1120,5 @@
new['value'] = new['ceiling'] - new['floor']
return new
-Globals.InitializeClass(TransientObjectContainer)
+InitializeClass(TransientObjectContainer)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/Transience/TransientObject.py
===================================================================
--- Zope/trunk/lib/python/Products/Transience/TransientObject.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/Transience/TransientObject.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,23 +15,30 @@
$Id$
"""
-
__version__='$Revision: 1.9.68.5 $'[11:-2]
-from Persistence import Persistent
-from Acquisition import Implicit
-import time, random, sys, os
-import thread
-from Products.Transience.TransienceInterfaces import ItemWithId, Transient, \
- DictionaryLike, TTWDictionary, ImmutablyValuedMappingOfPickleableObjects,\
- TransientItemContainer
-from AccessControl import ClassSecurityInfo
-import Globals
import logging
+import os
+import random
import sys
+import thread
+import time
+
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from Persistence import Persistent
from ZODB.POSException import ConflictError
from zope.interface import implements
+from Products.Transience.TransienceInterfaces import DictionaryLike
+from Products.Transience.TransienceInterfaces import \
+ ImmutablyValuedMappingOfPickleableObjects
+from Products.Transience.TransienceInterfaces import ItemWithId
+from Products.Transience.TransienceInterfaces import Transient
+from Products.Transience.TransienceInterfaces import TransientItemContainer
+from Products.Transience.TransienceInterfaces import TTWDictionary
+
DEBUG = int(os.environ.get('Z_TOC_DEBUG', 0))
LOG = logging.getLogger('Zope.TransientObject')
@@ -277,4 +284,4 @@
if m1 > m2: return -1 # d1 is "less than" d2
return 1
-Globals.InitializeClass(TransientObject)
+InitializeClass(TransientObject)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/BaseIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCTextIndex/BaseIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/BaseIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -18,18 +18,20 @@
import math
from BTrees.IOBTree import IOBTree
-from BTrees.IIBTree import IIBTree, IIBucket, IITreeSet
-from BTrees.IIBTree import intersection, difference
+from BTrees.IIBTree import IIBTree
+from BTrees.IIBTree import IIBucket
+from BTrees.IIBTree import IITreeSet
+from BTrees.IIBTree import difference
+from BTrees.IIBTree import intersection
from BTrees.Length import Length
+from Persistence import Persistent
+from zope.interface import implements
from Products.ZCTextIndex.IIndex import IIndex
from Products.ZCTextIndex import WidCode
-from Products.ZCTextIndex.SetOps import mass_weightedIntersection, \
- mass_weightedUnion
+from Products.ZCTextIndex.SetOps import mass_weightedIntersection
+from Products.ZCTextIndex.SetOps import mass_weightedUnion
-import ZODB
-from Persistence import Persistent
-from zope.interface import implements
# Instead of storing floats, we generally store scaled ints. Binary pickles
# can store those more efficiently. The default SCALE_FACTOR of 1024
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/CosineIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCTextIndex/CosineIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/CosineIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -20,9 +20,10 @@
from zope.interface import implements
from Products.ZCTextIndex.IIndex import IIndex
-from Products.ZCTextIndex.BaseIndex import BaseIndex, \
- inverse_doc_frequency, \
- scaled_int, SCALE_FACTOR
+from Products.ZCTextIndex.BaseIndex import BaseIndex
+from Products.ZCTextIndex.BaseIndex import inverse_doc_frequency
+from Products.ZCTextIndex.BaseIndex import scaled_int
+from Products.ZCTextIndex.BaseIndex import SCALE_FACTOR
class CosineIndex(BaseIndex):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/HTMLSplitter.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCTextIndex/HTMLSplitter.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/HTMLSplitter.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -11,13 +11,13 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
+import re
+from zope.interface import implements
+
from Products.ZCTextIndex.ISplitter import ISplitter
from Products.ZCTextIndex.PipelineFactory import element_factory
-from zope.interface import implements
-import re
-
class HTMLWordSplitter:
implements(ISplitter)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/Lexicon.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCTextIndex/Lexicon.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/Lexicon.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -21,15 +21,13 @@
from BTrees.IOBTree import IOBTree
from BTrees.OIBTree import OIBTree
from BTrees.Length import Length
-
-import ZODB
from Persistence import Persistent
from zope.interface import implements
from Products.ZCTextIndex.StopDict import get_stopdict
from Products.ZCTextIndex.ParseTree import QueryError
from Products.ZCTextIndex.PipelineFactory import element_factory
-from interfaces import ILexicon
+from Products.ZCTextIndex.interfaces import ILexicon
class Lexicon(Persistent):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/OkapiIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCTextIndex/OkapiIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/OkapiIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -22,9 +22,9 @@
from zope.interface import implements
from Products.ZCTextIndex.IIndex import IIndex
-from Products.ZCTextIndex.BaseIndex import BaseIndex, \
- inverse_doc_frequency, \
- scaled_int
+from Products.ZCTextIndex.BaseIndex import BaseIndex
+from Products.ZCTextIndex.BaseIndex import inverse_doc_frequency
+from Products.ZCTextIndex.BaseIndex import scaled_int
from Products.ZCTextIndex.okascore import score
class OkapiIndex(BaseIndex):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/ParseTree.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCTextIndex/ParseTree.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/ParseTree.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -13,13 +13,12 @@
##############################################################################
"""Generic parser support: exception and parse tree nodes."""
+from BTrees.IIBTree import difference
from zope.interface import implements
-from BTrees.IIBTree import difference
-
from Products.ZCTextIndex.IQueryParseTree import IQueryParseTree
-from Products.ZCTextIndex.SetOps import mass_weightedIntersection, \
- mass_weightedUnion
+from Products.ZCTextIndex.SetOps import mass_weightedIntersection
+from Products.ZCTextIndex.SetOps import mass_weightedUnion
class QueryError(Exception):
pass
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/QueryParser.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCTextIndex/QueryParser.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/QueryParser.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -54,8 +54,8 @@
- these can be combined, e.g. ``foo -"foo bar"'' or ``foo -foo-bar''
- * and ? are used for globbing (i.e. prefix search), e.g. ``foo*''
"""
+import re
-import re
from zope.interface import implements
from Products.ZCTextIndex.IQueryParser import IQueryParser
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/SetOps.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCTextIndex/SetOps.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/SetOps.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -14,7 +14,9 @@
"""SetOps -- Weighted intersections and unions applied to many inputs."""
-from BTrees.IIBTree import IIBucket, weightedIntersection, weightedUnion
+from BTrees.IIBTree import IIBucket
+from BTrees.IIBTree import weightedIntersection
+from BTrees.IIBTree import weightedUnion
from Products.ZCTextIndex.NBest import NBest
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/ZCTextIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCTextIndex/ZCTextIndex.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCTextIndex/ZCTextIndex.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -18,36 +18,41 @@
from cgi import escape
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.Permissions import manage_zcatalog_indexes
+from AccessControl.Permissions import search_zcatalog
+from Acquisition import aq_base
+from Acquisition import aq_inner
+from Acquisition import aq_parent
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from OFS.SimpleItem import SimpleItem
from Persistence import Persistent
-import Acquisition
-from Acquisition import aq_base, aq_inner, aq_parent
-from OFS.SimpleItem import SimpleItem
-from Globals import DTMLFile, InitializeClass
-from AccessControl.SecurityInfo import ClassSecurityInfo
-from AccessControl.Permissions import manage_zcatalog_indexes, search_zcatalog
from zope.interface import implements
from Products.PluginIndexes.common.util import parseIndexRequest
from Products.PluginIndexes.common import safe_callable
from Products.PluginIndexes.interfaces import IPluggableIndex
-from Products.ZCTextIndex.Lexicon import \
- Lexicon, Splitter, CaseNormalizer, StopWordRemover
+from Products.ZCTextIndex.Lexicon import CaseNormalizer
+from Products.ZCTextIndex.Lexicon import Lexicon
+from Products.ZCTextIndex.Lexicon import Splitter
+from Products.ZCTextIndex.Lexicon import StopWordRemover
from Products.ZCTextIndex.NBest import NBest
from Products.ZCTextIndex.QueryParser import QueryParser
-from CosineIndex import CosineIndex
-from interfaces import ILexicon
-from interfaces import IZCLexicon
-from interfaces import IZCTextIndex
-from OkapiIndex import OkapiIndex
-from PipelineFactory import element_factory
+from Products.ZCTextIndex.CosineIndex import CosineIndex
+from Products.ZCTextIndex.interfaces import ILexicon
+from Products.ZCTextIndex.interfaces import IZCLexicon
+from Products.ZCTextIndex.interfaces import IZCTextIndex
+from Products.ZCTextIndex.OkapiIndex import OkapiIndex
+from Products.ZCTextIndex.PipelineFactory import element_factory
-
index_types = {'Okapi BM25 Rank':OkapiIndex,
'Cosine Measure':CosineIndex}
-class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem):
+class ZCTextIndex(Persistent, Implicit, SimpleItem):
"""Persistent text index.
"""
@@ -315,7 +320,7 @@
LexiconMgmtPerm = 'Manage Vocabulary'
-class PLexicon(Lexicon, Acquisition.Implicit, SimpleItem):
+class PLexicon(Lexicon, Implicit, SimpleItem):
"""Lexicon for ZCTextIndex.
"""
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/CatalogAwareness.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/CatalogAwareness.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/CatalogAwareness.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -10,16 +10,15 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
-
"""ZCatalog Findable class
**NOTE**: This module is deprecated, and should only be used for
backward-compatibility. All new code should use CatalogPathAwareness.
"""
-
import urllib
-from Globals import DTMLFile
+
from Acquisition import aq_base
+from App.special_dtml import DTMLFile
class CatalogAware:
""" This is a Mix-In class to make objects automaticly catalog and
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/CatalogPathAwareness.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/CatalogPathAwareness.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/CatalogPathAwareness.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -10,11 +10,11 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
+"""ZCatalog Findable class
+"""
-"""ZCatalog Findable class"""
-
-from Globals import DTMLFile
from Acquisition import aq_base
+from App.special_dtml import DTMLFile
class CatalogAware:
""" This is a Mix-In class to make objects automaticly catalog and
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/ZCatalog.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,37 +15,42 @@
$Id$
"""
+import logging
+import sys
+import string
+import time
+import urllib
from warnings import warn
-import urllib, time, sys, string, logging
-from Globals import DTMLFile, MessageDialog
-from Globals import InitializeClass
+from AccessControl.DTML import RestrictedDTML
+from AccessControl.Permission import name_trans
+from AccessControl.Permissions import manage_zcatalog_entries
+from AccessControl.Permissions import manage_zcatalog_indexes
+from AccessControl.Permissions import search_zcatalog
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
+from App.special_dtml import DTMLFile
+from DateTime.DateTime import DateTime
+from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
+from DocumentTemplate.DT_Util import Eval
from OFS.Folder import Folder
from OFS.ObjectManager import ObjectManager
-from DateTime import DateTime
-from Acquisition import Implicit
from Persistence import Persistent
-from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
-from DocumentTemplate.DT_Util import Eval
-from AccessControl import ClassSecurityInfo
-from AccessControl.Permission import name_trans
-from AccessControl.DTML import RestrictedDTML
-from AccessControl.Permissions import \
- manage_zcatalog_entries, manage_zcatalog_indexes, search_zcatalog
+from Products.PluginIndexes.interfaces import IPluggableIndex
+import transaction
from ZODB.POSException import ConflictError
-import transaction
-from Products.PluginIndexes.interfaces import IPluggableIndex
from zope.interface import implements
-from Catalog import Catalog, CatalogError
-from interfaces import IZCatalog
-from ProgressHandler import ZLogHandler
-from ZCatalogIndexes import ZCatalogIndexes
+from Products.ZCatalog.Catalog import Catalog, CatalogError
+from Products.ZCatalog.interfaces import IZCatalog
+from Products.ZCatalog.ProgressHandler import ZLogHandler
+from Products.ZCatalog.ZCatalogIndexes import ZCatalogIndexes
-
LOG = logging.getLogger('Zope.ZCatalog')
-manage_addZCatalogForm=DTMLFile('dtml/addZCatalog',globals())
+manage_addZCatalogForm = DTMLFile('dtml/addZCatalog', globals())
def manage_addZCatalog(self, id, title,
vocab_id=None, # Deprecated
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/ZCatalogIndexes.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/ZCatalogIndexes.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZCatalog/ZCatalogIndexes.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,17 +15,17 @@
$Id$
"""
-from Acquisition import Implicit
-from Persistence import Persistent
-from Globals import DTMLFile, InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.Permissions import manage_zcatalog_indexes
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
from OFS.Folder import Folder
from OFS.ObjectManager import IFAwareObjectManager
from OFS.SimpleItem import SimpleItem
+from Persistence import Persistent
from Products.PluginIndexes.interfaces import IPluggableIndex
-
_marker = []
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZReST/ZReST.py
===================================================================
--- Zope/trunk/lib/python/Products/ZReST/ZReST.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZReST/ZReST.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -8,20 +8,24 @@
'''
+import docutils.core
+import docutils.io
+from docutils.writers.html4css1 import HTMLTranslator
+from docutils.writers.html4css1 import Writer
import sys
-import docutils.core, docutils.io
-from docutils.writers.html4css1 import HTMLTranslator, Writer
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityInfo import ModuleSecurityInfo
from Acquisition import Implicit
-from Persistence import Persistent
+from App.class_init import default__class_init__ as InitializeClass
+from App.config import getConfiguration
+from App.special_dtml import DTMLFile
+from DateTime.DateTime import DateTime
from OFS.SimpleItem import Item
from OFS.PropertyManager import PropertyManager
-from OFS.History import Historical, html_diff
-from Globals import InitializeClass, DTMLFile
-from AccessControl import ClassSecurityInfo
-from AccessControl import ModuleSecurityInfo
-from DateTime.DateTime import DateTime
-from App.config import getConfiguration
+from OFS.History import Historical
+from OFS.History import html_diff
+from Persistence import Persistent
modulesecurity = ModuleSecurityInfo()
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZSQLMethods/SQL.py
===================================================================
--- Zope/trunk/lib/python/Products/ZSQLMethods/SQL.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Products/ZSQLMethods/SQL.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -16,11 +16,11 @@
$Id$'''
__version__='$Revision: 1.21 $'[11:-2]
-import Shared.DC.ZRDB.DA
-from Globals import DTMLFile
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import change_database_methods
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from Shared.DC.ZRDB.DA import DA
def SQLConnectionIDs(self):
"""Find SQL database connections in the current folder and above
@@ -81,7 +81,7 @@
REQUEST.RESPONSE.redirect(u)
return ''
-class SQL(Shared.DC.ZRDB.DA.DA):
+class SQL(DA):
"""SQL Database methods
SQL Database methods are used to access external SQL databases.
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/Scripts/Bindings.py
===================================================================
--- Zope/trunk/lib/python/Shared/DC/Scripts/Bindings.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/Scripts/Bindings.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -13,7 +13,8 @@
__version__='$Revision$'[11:-2]
-from Globals import InitializeClass
+#from Globals import InitializeClass
+from App.class_init import default__class_init__ as InitializeClass
from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager
from AccessControl.Permissions import view_management_screens
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/Scripts/BindingsUI.py
===================================================================
--- Zope/trunk/lib/python/Shared/DC/Scripts/BindingsUI.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/Scripts/BindingsUI.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -13,11 +13,11 @@
__version__='$Revision$'[11:-2]
-import Globals
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import view_management_screens
-from Bindings import Bindings
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from Shared.DC.Scripts.Bindings import Bindings
class BindingsUI(Bindings):
@@ -31,7 +31,7 @@
security.declareProtected(view_management_screens,
'ZBindingsHTML_editForm')
- ZBindingsHTML_editForm = Globals.DTMLFile('dtml/scriptBindings', globals())
+ ZBindingsHTML_editForm = DTMLFile('dtml/scriptBindings', globals())
security.declareProtected('Change bindings', 'ZBindingsHTML_editAction')
def ZBindingsHTML_editAction(self, REQUEST):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/Scripts/Script.py
===================================================================
--- Zope/trunk/lib/python/Shared/DC/Scripts/Script.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/Scripts/Script.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,23 +15,23 @@
This provides generic script support
"""
-
__version__='$Revision$'[11:-2]
-from Globals import InitializeClass
-from Globals import DTMLFile
-from AccessControl import ClassSecurityInfo
-from AccessControl.Permissions import view_management_screens
-from OFS.SimpleItem import SimpleItem
from string import join
from urllib import quote
-from BindingsUI import BindingsUI
-from Bindings import defaultBindings
+
+from AccessControl.Permissions import view_management_screens
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
from DocumentTemplate.DT_Util import TemplateDict
+from OFS.SimpleItem import SimpleItem
from zExceptions import Redirect
+from Shared.DC.Scripts.BindingsUI import BindingsUI
+from Shared.DC.Scripts.Bindings import defaultBindings
# Temporary:
-from Signature import FuncCode
+from Shared.DC.Scripts.Signature import FuncCode
class Script(SimpleItem, BindingsUI):
"""Web-callable script mixin
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/ZRDB/Aqueduct.py
===================================================================
--- Zope/trunk/lib/python/Shared/DC/ZRDB/Aqueduct.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/ZRDB/Aqueduct.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,40 +15,53 @@
$Id$'''
__version__='$Revision: 1.58 $'[11:-2]
-import Globals, os
-from Globals import Persistent
-import DocumentTemplate, DateTime, re, string
-import binascii, Acquisition
-DateTime.now=DateTime.DateTime
+import binascii
from cStringIO import StringIO
-from OFS import SimpleItem
+import os
+import re
+import string
+
from AccessControl.Role import RoleManager
+from Acquisition import Implicit
+from App.Common import package_home
+from DateTime.DateTime import DateTime
+from DocumentTemplate import File
from DocumentTemplate import HTML
+from OFS.SimpleItem import Item
+from Persistence import Persistent
from zExceptions import Redirect
-from string import strip, replace
-dtml_dir=os.path.join(Globals.package_home(globals()), 'dtml')
+dtml_dir=os.path.join(package_home(globals()), 'dtml')
InvalidParameter='Invalid Parameter'
-class BaseQuery(Persistent, SimpleItem.Item,
- Acquisition.Implicit, RoleManager):
+class BaseQuery(Persistent, Item, Implicit, RoleManager):
- def query_year(self): return self.query_date.year()
- def query_month(self): return self.query_date.month()
- def query_day(self): return self.query_date.day()
- query_date=DateTime.now()
+ def query_year(self):
+ return self.query_date.year()
+
+ def query_month(self):
+ return self.query_date.month()
+
+ def query_day(self):
+ return self.query_date.day()
+
+ query_date = DateTime()
manage_options=()
- def quoted_input(self): return quotedHTML(self.input_src)
- def quoted_report(self): return quotedHTML(self.report_src)
+ def quoted_input(self):
+ return quotedHTML(self.input_src)
- MissingArgumentError='Bad Request'
+ def quoted_report(self):
+ return quotedHTML(self.report_src)
- def _convert(self): self._arg=parse(self.arguments_src)
+ MissingArgumentError = 'Bad Request'
+ def _convert(self):
+ self._arg=parse(self.arguments_src)
+
def _argdata(self, REQUEST):
r={}
@@ -212,9 +225,9 @@
)
-custom_default_report_src=DocumentTemplate.File(
+custom_default_report_src=File(
os.path.join(dtml_dir,'customDefaultReport.dtml'))
-custom_default_zpt_report_src=DocumentTemplate.File(
+custom_default_zpt_report_src=File(
os.path.join(dtml_dir,'customDefaultZPTReport.dtml'))
def custom_default_report(id, result, action='', no_table=0,
@@ -380,12 +393,12 @@
for re,name in character_entities:
- text=replace(text,re,name)
+ text=string.replace(text,re,name)
return text
def nicify(name):
- name=replace(string.strip(name), '_',' ')
+ name=string.replace(string.strip(name), '_',' ')
return string.upper(name[:1])+name[1:]
def decapitate(html, RESPONSE=None,
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/ZRDB/DA.py
===================================================================
--- Zope/trunk/lib/python/Shared/DC/ZRDB/DA.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/ZRDB/DA.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -11,70 +11,87 @@
#
##############################################################################
__doc__='''Generic Database adapter'''
-
-
__version__='$Revision: 1.116 $'[11:-2]
-import OFS.SimpleItem, Aqueduct, RDB, re
-import DocumentTemplate, marshal, md5, base64, Acquisition, os
-from Aqueduct import decodestring, parse
-from Aqueduct import custom_default_report, default_input_form
-from Globals import DTMLFile, MessageDialog
+import base64
+from cPickle import dumps
+from cPickle import loads
from cStringIO import StringIO
-import sys, Globals, OFS.SimpleItem, AccessControl.Role
-from string import atoi, find, join, split, rstrip
-import DocumentTemplate, sqlvar, sqltest, sqlgroup
-from DocumentTemplate.html_quote import html_quote
+import marshal
+import md5
+import os
+import re
+import string
+import sys
from time import time
-from zlib import compress, decompress
-from DateTime.DateTime import DateTime
-md5new=md5.new
-import ExtensionClass
-import DocumentTemplate.DT_Util
-from cPickle import dumps, loads
-from Results import Results
-from App.Extensions import getBrain
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
-from AccessControl import getSecurityManager
+from zlib import compress
+from zlib import decompress
+
+from AccessControl.DTML import RestrictedDTML
from AccessControl.Permissions import change_database_methods
from AccessControl.Permissions import use_database_methods
from AccessControl.Permissions import view_management_screens
-from AccessControl.DTML import RestrictedDTML
+from AccessControl.Role import RoleManager
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.Dialogs import MessageDialog
+from App.Extensions import getBrain
+from App.special_dtml import DTMLFile
+from DocumentTemplate import HTML
+from DocumentTemplate.html_quote import html_quote
+from DateTime.DateTime import DateTime
+from ExtensionClass import Base
+from BTrees.OOBTree import OOBucket as Bucket
+from OFS.SimpleItem import Item
+from Persistence import Persistent
from webdav.Resource import Resource
from webdav.Lockable import ResourceLockedError
from zExceptions import BadRequest
-from BTrees.OOBTree import OOBucket as Bucket
+from Aqueduct import BaseQuery
+from Aqueduct import custom_default_report
+from Aqueduct import decodestring
+from Aqueduct import default_input_form
+from Aqueduct import parse
+from RDB import File
+from Results import Results
+from sqlgroup import SQLGroup
+from sqltest import SQLTest
+from sqlvar import SQLVar
+md5new = md5.new
+
class DatabaseError(BadRequest):
" base class for external relational data base connection problems "
pass
-class nvSQL(DocumentTemplate.HTML):
+class nvSQL(HTML):
# Non-validating SQL Template for use by SQLFiles.
commands={}
- for k, v in DocumentTemplate.HTML.commands.items(): commands[k]=v
- commands['sqlvar' ]=sqlvar.SQLVar
- commands['sqltest']=sqltest.SQLTest
- commands['sqlgroup' ]=sqlgroup.SQLGroup
+ for k, v in HTML.commands.items():
+ commands[k]=v
+ commands['sqlvar'] = SQLVar
+ commands['sqltest'] = SQLTest
+ commands['sqlgroup' ] = SQLGroup
_proxy_roles=()
-class SQL(RestrictedDTML, ExtensionClass.Base, nvSQL):
+class SQL(RestrictedDTML, Base, nvSQL):
# Validating SQL template for Zope SQL Methods.
pass
-class DA(
- Aqueduct.BaseQuery,Acquisition.Implicit,
- Globals.Persistent,
- AccessControl.Role.RoleManager,
- OFS.SimpleItem.Item,
- Resource
- ):
+class DA(BaseQuery,
+ Implicit,
+ Persistent,
+ RoleManager,
+ Item,
+ Resource
+ ):
'Database Adapter'
security = ClassSecurityInfo()
@@ -101,8 +118,8 @@
{'label':'Advanced', 'action':'manage_advancedForm',
'help':('ZSQLMethods','Z-SQL-Method_Advanced.stx')},
)
- +AccessControl.Role.RoleManager.manage_options
- +OFS.SimpleItem.Item.manage_options
+ + RoleManager.manage_options
+ + Item.manage_options
)
def __init__(self, id, title, connection_id, arguments, template):
@@ -221,11 +238,11 @@
"""
# paranoid type checking
if type(max_rows) is not type(1):
- max_rows=atoi(max_rows)
+ max_rows=string.atoi(max_rows)
if type(max_cache) is not type(1):
- max_cache=atoi(max_cache)
+ max_cache=string.atoi(max_cache)
if type(cache_time) is not type(1):
- cache_time=atoi(cache_time)
+ cache_time=string.atoi(cache_time)
class_name=str(class_name)
class_file=str(class_file)
@@ -304,7 +321,7 @@
input_src=default_input_form(self.title_or_id(),
self._arg, 'manage_test',
'<dtml-var manage_tabs>')
- return DocumentTemplate.HTML(input_src)(self, REQUEST, HTTP_REFERER='')
+ return HTML(input_src)(self, REQUEST, HTTP_REFERER='')
security.declareProtected(change_database_methods, 'manage_test')
def manage_test(self, REQUEST):
@@ -319,8 +336,8 @@
try:
try:
src, result=self(REQUEST, test__=1)
- if find(src,'\0'):
- src=join(split(src,'\0'),'\n'+'-'*60+'\n')
+ if string.find(src,'\0'):
+ src=string.join(string.split(src,'\0'),'\n'+'-'*60+'\n')
if result._searchable_result_columns():
r=custom_default_report(self.id, result)
else:
@@ -329,7 +346,7 @@
t, v, tb = sys.exc_info()
r='<strong>Error, <em>%s</em>:</strong> %s' % (t, v)
- report=DocumentTemplate.HTML(
+ report = HTML(
'<html>\n'
'<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">\n'
'<dtml-var manage_tabs>\n<hr>\n%s\n\n'
@@ -448,25 +465,31 @@
__traceback_supplement__ = (SQLMethodTracebackSupplement, self)
if REQUEST is None:
- if kw: REQUEST=kw
+ if kw:
+ REQUEST=kw
else:
- if hasattr(self, 'REQUEST'): REQUEST=self.REQUEST
- else: REQUEST={}
+ if hasattr(self, 'REQUEST'):
+ REQUEST=self.REQUEST
+ else:
+ REQUEST={}
# connection hook
c = self.connection_id
# for backwards compatability
hk = self.connection_hook
# go get the connection hook and call it
- if hk: c = getattr(self, hk)()
+ if hk:
+ c = getattr(self, hk)()
- try: dbc=getattr(self, c)
+ try:
+ dbc=getattr(self, c)
except AttributeError:
raise AttributeError, (
"The database connection <em>%s</em> cannot be found." % (
c))
- try: DB__=dbc()
+ try:
+ DB__=dbc()
except: raise DatabaseError, (
'%s is not connected to a database' % self.id)
@@ -474,7 +497,8 @@
p=self.aq_parent
if self._isBeingAccessedAsZClassDefinedInstanceMethod():
p=p.aq_parent
- else: p=None
+ else:
+ p=None
argdata=self._argdata(REQUEST)
argdata['sql_delimiter']='\0'
@@ -483,23 +507,27 @@
security=getSecurityManager()
security.addContext(self)
try:
- try: query=apply(self.template, (p,), argdata)
+ try:
+ query=apply(self.template, (p,), argdata)
except TypeError, msg:
msg = str(msg)
- if find(msg,'client') >= 0:
+ if string.find(msg,'client') >= 0:
raise NameError("'client' may not be used as an " +
"argument name in this context")
else: raise
- finally: security.removeContext(self)
+ finally:
+ security.removeContext(self)
- if src__: return query
+ if src__:
+ return query
if self.cache_time_ > 0 and self.max_cache_ > 0:
result=self._cached_result(DB__, query, self.max_rows_, c)
else:
result=DB__.query(query, self.max_rows_)
- if hasattr(self, '_v_brain'): brain=self._v_brain
+ if hasattr(self, '_v_brain'):
+ brain=self._v_brain
else:
brain=self._v_brain=getBrain(self.class_file_, self.class_name_)
@@ -510,15 +538,17 @@
f=StringIO()
f.write(result)
f.seek(0)
- result=RDB.File(f,brain,p, zc)
+ result = File(f,brain,p, zc)
else:
- result=Results(result, brain, p, zc)
- columns=result._searchable_result_columns()
- if test__ and columns != self._col: self._col=columns
+ result = Results(result, brain, p, zc)
+ columns = result._searchable_result_columns()
+ if test__ and columns != self._col:
+ self._col=columns
# If run in test mode, return both the query and results so
# that the template doesn't have to be rendered twice!
- if test__: return query, result
+ if test__:
+ return query, result
return result
@@ -570,7 +600,7 @@
ListType=type([])
-class Traverse(ExtensionClass.Base):
+class Traverse(Base):
"""Helper class for 'traversing' searches during URL traversal
"""
_da=None
@@ -603,7 +633,7 @@
results=da(args)
if results:
if len(results) > 1:
- try: return results[atoi(key)].__of__(da)
+ try: return results[string.atoi(key)].__of__(da)
except: raise KeyError, key
else: raise KeyError, key
r=results[0]
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/ZRDB/Search.py
===================================================================
--- Zope/trunk/lib/python/Shared/DC/ZRDB/Search.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Shared/DC/ZRDB/Search.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,10 +15,14 @@
$Id$'''
__version__='$Revision: 1.22 $'[11:-2]
-from Globals import DTMLFile
-from Aqueduct import custom_default_report, custom_default_zpt_report, nicify, Args
from string import join
from cgi import escape
+
+from App.special_dtml import DTMLFile
+from Aqueduct import custom_default_report
+from Aqueduct import custom_default_zpt_report
+from Aqueduct import nicify
+from Aqueduct import Args
from AccessControl import getSecurityManager
addForm=DTMLFile('dtml/searchAdd', globals())
Deleted: Zope/branches/tseaver-no_globals_imports/lib/python/Signals/Signals.py
===================================================================
--- Zope/trunk/lib/python/Signals/Signals.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Signals/Signals.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -1,132 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (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
-#
-##############################################################################
-"""
-Zope signal handlers for clean shutdown, restart and log rotation.
-
-$Id$
-"""
-__version__='$Revision: 1.3 $'[11:-2]
-
-import logging
-import sys, os
-
-import Lifetime
-
-logger = logging.getLogger("Z2")
-
-if os.name == 'nt':
- try:
- from WinSignalHandler import SignalHandler
- except ImportError:
- msg = ('Can not install signal handlers. Please install '
- '(or upgrade) your pywin32 installation '
- '(https://sf.net/projects/pywin32)')
- logger.warning(msg)
- SignalHandler = None
-else:
- from SignalHandler import SignalHandler
-
-def shutdownFastHandler():
- """Shutdown cleanly on SIGTERM. This is registered first,
- so it should be called after all other handlers."""
- logger.info("Shutting down fast")
- Lifetime.shutdown(0,fast=1)
-
-
-def shutdownHandler():
- """Shutdown cleanly on SIGINT. This is registered first,
- so it should be called after all other handlers."""
- logger.info("Shutting down")
- sys.exit(0)
-
-def restartHandler():
- """Restart cleanly on SIGHUP. This is registered first, so it
- should be called after all other SIGHUP handlers."""
- logger.info("Restarting")
- Lifetime.shutdown(1)
-
-class LogfileReopenHandler:
- """Reopen log files on SIGUSR2.
-
- This is registered first, so it should be called after all other
- SIGUSR2 handlers.
- """
- def __init__(self, loggers):
- self.loggers = [log for log in loggers if log is not None]
-
- def __call__(self):
- for log in self.loggers:
- log.reopen()
- logger.info("Log files reopened successfully")
-
-# On Windows, a 'reopen' is useless - the file can not be renamed
-# while open, so we perform a trivial 'rotate'.
-class LogfileRotateHandler:
- """Rotate log files on SIGUSR2. Only called on Windows. This is
- registered first, so it should be called after all other SIGUSR2
- handlers."""
- def __init__(self, loggers):
- self.loggers = [log for log in loggers if log is not None]
-
- def __call__(self):
- logger.debug("Log files rotation starting...")
- for log in self.loggers:
- for f in log.handler_factories:
- handler = f()
- if hasattr(handler, 'rotate') and callable(handler.rotate):
- handler.rotate()
- logger.info("Log files rotation complete")
-
-def packHandler():
- """ Packs the main database. Not safe to call under a signal
- handler, because it blocks the main thread """
- logger.info('Packing main ZODB database')
- import Globals
- try:
- db = Globals.opened[0]
- db.pack()
- logger.info('Database packing launched or completed successfully')
- except:
- logger.exception('Call to pack failed!')
-
-
-def registerZopeSignals(loggers):
- from signal import SIGTERM, SIGINT
- try:
- from signal import SIGHUP, SIGUSR1, SIGUSR2
- except ImportError:
- # Windows doesn't have these (but also doesn't care what the exact
- # numbers are)
- SIGHUP = 1
- SIGUSR1 = 10
- SIGUSR2 = 12
-
- if not SignalHandler:
- return
- SignalHandler.registerHandler(SIGTERM, shutdownFastHandler)
- SignalHandler.registerHandler(SIGINT, shutdownHandler)
- if os.name != 'nt':
- SignalHandler.registerHandler(SIGHUP, restartHandler)
- SignalHandler.registerHandler(SIGUSR2, LogfileReopenHandler(loggers))
- else:
- # no restart handler on windows.
- # Log files get 'rotated', not 'reopened'
- SignalHandler.registerHandler(SIGUSR2, LogfileRotateHandler(loggers))
- # SIGUSR1 is nominally reserved for pack, but we dont have an
- # implementation that is stable yet because if the signal handler
- # fires it will be caught in the main thread and all network operations
- # will cease until it's finished.
- # (The above is *not* True for Windows - a different thread is used to
- # catch the signals. This probably could be switched on for Windows
- # if anyone cares)
- #SignalHandler.registerHandler(SIGUSR1, packHandler)
Copied: Zope/branches/tseaver-no_globals_imports/lib/python/Signals/Signals.py (from rev 94365, Zope/trunk/lib/python/Signals/Signals.py)
===================================================================
--- Zope/branches/tseaver-no_globals_imports/lib/python/Signals/Signals.py (rev 0)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Signals/Signals.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -0,0 +1,111 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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
+#
+##############################################################################
+"""
+Zope signal handlers for clean shutdown, restart and log rotation.
+
+$Id$
+"""
+__version__='$Revision: 1.3 $'[11:-2]
+
+import logging
+import sys, os
+
+import Lifetime
+
+logger = logging.getLogger("Z2")
+
+if os.name == 'nt':
+ try:
+ from WinSignalHandler import SignalHandler
+ except ImportError:
+ msg = ('Can not install signal handlers. Please install '
+ '(or upgrade) your pywin32 installation '
+ '(https://sf.net/projects/pywin32)')
+ logger.warning(msg)
+ SignalHandler = None
+else:
+ from SignalHandler import SignalHandler
+
+def shutdownFastHandler():
+ """Shutdown cleanly on SIGTERM. This is registered first,
+ so it should be called after all other handlers."""
+ logger.info("Shutting down fast")
+ Lifetime.shutdown(0,fast=1)
+
+
+def shutdownHandler():
+ """Shutdown cleanly on SIGINT. This is registered first,
+ so it should be called after all other handlers."""
+ logger.info("Shutting down")
+ sys.exit(0)
+
+def restartHandler():
+ """Restart cleanly on SIGHUP. This is registered first, so it
+ should be called after all other SIGHUP handlers."""
+ logger.info("Restarting")
+ Lifetime.shutdown(1)
+
+class LogfileReopenHandler:
+ """Reopen log files on SIGUSR2.
+
+ This is registered first, so it should be called after all other
+ SIGUSR2 handlers.
+ """
+ def __init__(self, loggers):
+ self.loggers = [log for log in loggers if log is not None]
+
+ def __call__(self):
+ for log in self.loggers:
+ log.reopen()
+ logger.info("Log files reopened successfully")
+
+# On Windows, a 'reopen' is useless - the file can not be renamed
+# while open, so we perform a trivial 'rotate'.
+class LogfileRotateHandler:
+ """Rotate log files on SIGUSR2. Only called on Windows. This is
+ registered first, so it should be called after all other SIGUSR2
+ handlers."""
+ def __init__(self, loggers):
+ self.loggers = [log for log in loggers if log is not None]
+
+ def __call__(self):
+ logger.debug("Log files rotation starting...")
+ for log in self.loggers:
+ for f in log.handler_factories:
+ handler = f()
+ if hasattr(handler, 'rotate') and callable(handler.rotate):
+ handler.rotate()
+ logger.info("Log files rotation complete")
+
+def registerZopeSignals(loggers):
+ from signal import SIGTERM, SIGINT
+ try:
+ from signal import SIGHUP, SIGUSR1, SIGUSR2
+ except ImportError:
+ # Windows doesn't have these (but also doesn't care what the exact
+ # numbers are)
+ SIGHUP = 1
+ SIGUSR1 = 10
+ SIGUSR2 = 12
+
+ if not SignalHandler:
+ return
+ SignalHandler.registerHandler(SIGTERM, shutdownFastHandler)
+ SignalHandler.registerHandler(SIGINT, shutdownHandler)
+ if os.name != 'nt':
+ SignalHandler.registerHandler(SIGHUP, restartHandler)
+ SignalHandler.registerHandler(SIGUSR2, LogfileReopenHandler(loggers))
+ else:
+ # no restart handler on windows.
+ # Log files get 'rotated', not 'reopened'
+ SignalHandler.registerHandler(SIGUSR2, LogfileRotateHandler(loggers))
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/Basic.py
===================================================================
--- Zope/trunk/lib/python/ZClasses/Basic.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/Basic.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -13,18 +13,19 @@
"""Basic Item class and class manager
"""
-import Globals, OFS.PropertySheets, OFS.Image, ExtensionClass
-import Acquisition, Products
+from Acquisition import Acquired
+from App.special_dtml import DTMLFile
+from OFS.Image import Image
+from OFS.PropertySheets import PropertySheet
+from OFS.PropertySheets import View
from zExceptions import BadRequest
-class ZClassBasicSheet(OFS.PropertySheets.PropertySheet,
- OFS.PropertySheets.View):
+class ZClassBasicSheet(PropertySheet, View):
"""Provide management view for item classes
"""
+ _getZClass = Acquired
- _getZClass=Acquisition.Acquired
-
- manage=Globals.DTMLFile('dtml/itemProp', globals())
+ manage = DTMLFile('dtml/itemProp', globals())
def manage_edit(self, meta_type='', icon='', file='',
class_id=None, title=None,
selected=(),
@@ -38,7 +39,7 @@
image=self.getClassAttr('ziconImage', None)
if image is None:
self.setClassAttr('ziconImage',
- OFS.Image.Image('ziconImage','',file))
+ Image('ziconImage','',file))
else:
image.manage_upload(file)
@@ -71,15 +72,14 @@
def zClassTitle(self): return self._getZClass().title
-class ZClassViewsSheet(OFS.PropertySheets.PropertySheet,
- OFS.PropertySheets.View):
+class ZClassViewsSheet(PropertySheet, View):
"""Provide an options management view
"""
def data(self):
return self.getClassAttr('manage_options',(),1)
- manage=Globals.DTMLFile('dtml/views', globals())
+ manage = DTMLFile('dtml/views', globals())
def manage_edit(self, actions=[], helps=[], REQUEST=None):
"Change view actions"
options=self.data()
@@ -182,13 +182,13 @@
self, REQUEST, manage_tabs_message=message)
-class ZClassPermissionsSheet(OFS.PropertySheets.PropertySheet,
- OFS.PropertySheets.View):
+class ZClassPermissionsSheet(PropertySheet, View):
"Manage class permissions"
- manage=Globals.DTMLFile('dtml/classPermissions', globals())
+ manage = DTMLFile('dtml/classPermissions', globals())
def possible_permissions(self):
+ import Products
Products_permissions = getattr(Products, '__ac_permissions__', ())
r=map(
lambda p: p[0],
@@ -200,6 +200,7 @@
def manage_edit(self, selected=[], REQUEST=None):
"Remove some permissions"
+ import Products
Products_permissions = getattr(Products, '__ac_permissions__', ())
r=[]
for p in (
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/Method.py
===================================================================
--- Zope/trunk/lib/python/ZClasses/Method.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/Method.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -12,41 +12,50 @@
##############################################################################
"""Basic Item class and class manager
"""
+from cgi import escape
+import marshal
-import Acquisition, ExtensionClass, Globals, OFS.PropertySheets, OFS.Folder
from AccessControl.Permission import pname
-import App.Dialogs, ZClasses, App.Factory, App.ProductRegistry
-import ZClassOwner
-from AccessControl.PermissionMapping import aqwrap, PermissionMapper
-
+from AccessControl.PermissionMapping import aqwrap
+from AccessControl.PermissionMapping import PermissionMapper
+from App.Factory import Factory
+from App.ProductRegistry import ProductRegistryMixin
+from App.special_dtml import HTMLFile
+from ExtensionClass import Base
from OFS.DTMLMethod import DTMLMethod
+from OFS.Folder import Folder
+from OFS.PropertySheets import PropertySheet
+from OFS.PropertySheets import View
+from Persistence import Persistent
from Products.PythonScripts.PythonScript import PythonScript
from zExceptions import BadRequest
-
-import marshal
-from cgi import escape
from zope.contenttype import guess_content_type
+from ZClasses.ZClassOwner import ZClassOwner
+
_marker=[]
-class ZClassMethodsSheet(
- OFS.PropertySheets.PropertySheet,
- OFS.PropertySheets.View,
- OFS.Folder.Folder,
- App.ProductRegistry.ProductRegistryMixin,
- ZClassOwner.ZClassOwner):
- "Manage instance methods"
- id='contents'
- icon='p_/Methods_icon'
- def tpURL(self): return 'propertysheets/methods'
+class ZClassMethodsSheet(PropertySheet,
+ View,
+ Folder,
+ ProductRegistryMixin,
+ ZClassOwner,
+ ):
+ """Manage instance methods
+ """
+ id = 'contents'
+ icon = 'p_/Methods_icon'
+ def tpURL(self):
+ return 'propertysheets/methods'
+
######################################################################
# Hijinks to let us create factories and classes within classes.
meta_types=(
{'name': 'Z Class',
'action':'manage_addZClassForm'},
- {'name': App.Factory.Factory.meta_type,
+ {'name': Factory.meta_type,
'action': 'manage_addPrincipiaFactoryForm'
},
{'name': 'Property Sheet Interface',
@@ -56,8 +65,9 @@
def manage_addPrincipiaFactory(
self, id, title, object_type, initial, permission=None, REQUEST=None):
- ' '
- i=App.Factory.Factory(id, title, object_type, initial, permission)
+ """ Add a factory.
+ """
+ i = Factory(id, title, object_type, initial, permission)
self._setObject(id,i)
factory = self._getOb(id)
factory.initializePermission()
@@ -75,7 +85,7 @@
######################################################################
- manage_addPropertyInterfaceForm=Globals.HTMLFile(
+ manage_addPropertyInterfaceForm = HTMLFile(
'dtml/addPropertyInterface',
globals())
@@ -210,7 +220,7 @@
methodattr='_ZClassMethodPermissionMapperMethod_'
-class MW(ExtensionClass.Base):
+class MW(Base):
def __init__(self, meth): self.__dict__[methodattr]=meth
@@ -222,7 +232,7 @@
if hasattr(m,'__of__'): return aqwrap(m, wrapper, parent)
return m
-class MWp(Globals.Persistent):
+class MWp(Persistent):
def __init__(self, meth): self.__dict__[methodattr]=meth
__setstate__=__init__
@@ -242,7 +252,7 @@
# Backward compat. Waaaaa
-class W(Globals.Persistent, MW):
+class W(Persistent, MW):
_View_Permission='_View_Permission'
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/ObjectManager.py
===================================================================
--- Zope/trunk/lib/python/ZClasses/ObjectManager.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/ObjectManager.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -13,16 +13,20 @@
"""Object-manager mix-in for ZClasses
"""
-import OFS.ObjectManager, Globals, Products
+from App.special_dtml import DTMLFile
+from OFS.ObjectManager import ObjectManager as BaseObjectManager
+from OFS.PropertySheets import PropertySheet
+from OFS.PropertySheets import PropertySheets
+from OFS.PropertySheets import View
-class SubobjectsSheet(OFS.PropertySheets.PropertySheet,
- OFS.PropertySheets.View):
+class SubobjectsSheet(PropertySheet, View):
"""Provide management view for selecting sub-objects.
"""
- manage=Globals.DTMLFile('dtml/subobjects', globals())
+ manage = DTMLFile('dtml/subobjects', globals())
def possible_meta_types(self):
- return self.aq_acquire('_product_meta_types')+Products.meta_types
+ import Products
+ return self.aq_acquire('_product_meta_types') + Products.meta_types
def selected_meta_types(self):
return map(lambda v: v['name'], self.getClassAttr('meta_types',()))
@@ -43,11 +47,11 @@
def isFolderish(self):
return self.getClassAttr('isPrincipiaFolderish', 0, 1)
-class ZObjectManagerPropertySheets(OFS.PropertySheets.PropertySheets):
+class ZObjectManagerPropertySheets(PropertySheets):
subobjects=SubobjectsSheet('subobjects')
-class ObjectManager(OFS.ObjectManager.ObjectManager):
+class ObjectManager(BaseObjectManager):
_zclass_method_meta_types=()
@@ -57,9 +61,8 @@
class ZObjectManager:
"""Mix-in for Object Management
"""
+ _zclass_ = ObjectManager
- _zclass_=ObjectManager
-
propertysheets=ZObjectManagerPropertySheets()
manage_options=(
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/Property.py
===================================================================
--- Zope/trunk/lib/python/ZClasses/Property.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/Property.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -13,16 +13,23 @@
"""Provide management of common instance property sheets
"""
-import transaction
-import OFS.PropertySheets, Globals, OFS.SimpleItem, OFS.PropertyManager
-import Acquisition
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
from AccessControl.Permission import pname
from AccessControl.Permissions import manage_zclasses
from AccessControl.Permissions import manage_properties
from AccessControl.Permissions import access_contents_information
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from OFS.ObjectManager import ObjectManager
+from OFS.PropertySheets import FixedSchema
+from OFS.PropertySheets import PropertySheet
+from OFS.PropertySheets import PropertySheets
+from OFS.PropertySheets import View
+from OFS.SimpleItem import Item
+from OFS.Traversable import Traversable
+from Persistence import Persistent
+import transaction
class ClassCaretaker:
def __init__(self, klass): self.__dict__['_k']=klass
@@ -41,7 +48,7 @@
klass._p_changed=1
-class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item):
+class ZCommonSheet(PropertySheet, Item):
"Property Sheet that has properties common to all instances"
meta_type="Common Instance Property Sheet"
_properties=()
@@ -200,7 +207,7 @@
def permissionMappingPossibleValues(self):
return self.classDefinedAndInheritedPermissions()
- manage_security=Globals.DTMLFile('AccessControl/dtml/methodAccess')
+ manage_security = DTMLFile('AccessControl/dtml/methodAccess')
def manage_getPermissionMapping(self):
ips=self.getClassAttr('propertysheets')
ips=getattr(ips, self.id)
@@ -252,9 +259,7 @@
'Manage properties',
)
-class ZInstanceSheet(OFS.PropertySheets.FixedSchema,
- OFS.PropertySheets.View,
- ):
+class ZInstanceSheet(FixedSchema, View):
"Waaa this is too hard"
security = ClassSecurityInfo()
@@ -285,9 +290,7 @@
transaction.get().register(klass)
klass._p_changed=1
-class ZInstanceSheetsSheet(OFS.Traversable.Traversable,
- OFS.PropertySheets.View,
- OFS.ObjectManager.ObjectManager):
+class ZInstanceSheetsSheet(Traversable, View, ObjectManager):
"Manage common property sheets"
# Note that we need to make sure we add and remove
@@ -315,20 +318,17 @@
pc.__propset_attrs__=tuple(map(lambda o: o['id'], self._objects))
rclass(pc)
- meta_types=(
- Globals.Dictionary(name=ZCommonSheet.meta_type,
- action='manage_addCommonSheetForm'),
- )
+ meta_types=({'name': ZCommonSheet.meta_type,
+ 'action': 'manage_addCommonSheetForm',
+ },)
def all_meta_types(self): return self.meta_types
- manage=Globals.DTMLFile('OFS/dtml/main',
- management_view='Property Sheets')
+ manage = DTMLFile('OFS/dtml/main', management_view='Property Sheets')
manage_main = manage
manage_main._setName('manage_main')
- manage_addCommonSheetForm=Globals.DTMLFile('dtml/addCommonSheet',
- globals())
+ manage_addCommonSheetForm = DTMLFile('dtml/addCommonSheet', globals())
def manage_addCommonSheet(self, id, title, REQUEST=None):
"Add a property sheet"
@@ -345,7 +345,7 @@
klass_sequence(klass, attr, result)
return result
-class ZInstanceSheets(OFS.PropertySheets.PropertySheets, Globals.Persistent):
+class ZInstanceSheets(PropertySheets, Persistent):
" "
__propset_attrs__=()
_implements_the_notional_subclassable_propertysheet_class_interface=1
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/ZClass.py
===================================================================
--- Zope/trunk/lib/python/ZClasses/ZClass.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/ZClass.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -12,26 +12,39 @@
##############################################################################
"""Zope Classes
"""
-import Globals, OFS.SimpleItem, OFS.PropertySheets, Products
-from Globals import InitializeClass
-import Method, Basic, Property, AccessControl.Role, re
-from AccessControl import ClassSecurityInfo
+import marshal
+import re
+
from AccessControl.Permissions import create_class_instances
-
-from ZPublisher.mapply import mapply
-from ExtensionClass import Base
+from AccessControl.Role import gather_permissions
+from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import aq_base
+from App.class_init import default__class_init__ as InitializeClass
from App.FactoryDispatcher import FactoryDispatcher
+from App.ImageFile import ImageFile
+from App.special_dtml import DTMLFile
from ComputedAttribute import ComputedAttribute
-from Products.PythonScripts.PythonScript import PythonScript
-from zExceptions import BadRequest, Redirect
-import webdav.Collection
-import ZClasses._pmc
+from ExtensionClass import Base
+from OFS.SimpleItem import SimpleItem
+from OFS.PropertySheets import PropertySheets
+from Persistence import Persistent
+from webdav.Collection import Collection
+from zExceptions import BadRequest
+from zExceptions import Redirect
+from ZPublisher.mapply import mapply
import transaction
-import marshal
+from ZClasses._pmc import ZClassPersistentMetaClass
+from ZClasses.Method import findMethodIds
+from ZClasses.Method import ZClassMethodsSheet
+from ZClasses.Basic import ZClassViewsSheet
+from ZClasses.Basic import ZClassBasicSheet
+from ZClasses.Basic import ZClassPermissionsSheet
+from ZClasses.Property import ZInstanceSheets
+from ZClasses.Property import ZInstanceSheetsSheet
+import Products
if not hasattr(Products, 'meta_types'):
Products.meta_types=()
@@ -59,7 +72,7 @@
exec 'class %s: pass' % nice_name in d
Z = d[nice_name]
- Z.propertysheets = OFS.PropertySheets.PropertySheets()
+ Z.propertysheets = PropertySheets()
Z._zclass_ = base_class
Z.manage_options = ()
@@ -95,11 +108,11 @@
from OFS.misc_ import p_
-p_.ZClass_Icon=Globals.ImageFile('class.gif', globals())
+p_.ZClass_Icon = ImageFile('class.gif', globals())
-class PersistentClass(Base, webdav.Collection.Collection ):
+class PersistentClass(Base, Collection):
- __metaclass__ = ZClasses._pmc.ZClassPersistentMetaClass
+ __metaclass__ = ZClassPersistentMetaClass
# We need this class to be treated as a normal global class, even
# though it is an instance of ZClassPersistentMetaClass.
@@ -111,7 +124,7 @@
def __class_init__(self):
pass
-manage_addZClassForm=Globals.DTMLFile(
+manage_addZClassForm = DTMLFile(
'dtml/addZClass', globals(),
default_class_='OFS.SimpleItem Item',
CreateAFactory=1,
@@ -163,6 +176,7 @@
self._setObject(id, Z)
if CreateAFactory and meta_type:
+ from Products.PythonScripts.PythonScript import PythonScript
self.manage_addDTMLMethod(
id+'_addForm',
id+' constructor input form',
@@ -210,10 +224,7 @@
return dict
_marker=[]
-class ZClass( Base
- , webdav.Collection.Collection
- , OFS.SimpleItem.SimpleItem
- ):
+class ZClass(Base, Collection, SimpleItem):
"""Zope Class
"""
meta_type="Z Class"
@@ -257,16 +268,16 @@
except AttributeError: pass
if zope_object:
- base_classes.append(OFS.SimpleItem.SimpleItem)
+ base_classes.append(SimpleItem)
zsheets_base_classes.append(ZClassSheets)
- isheets_base_classes.append(Property.ZInstanceSheets)
+ isheets_base_classes.append(ZInstanceSheets)
# Create the meta-class property sheet
sheet_id = id+'_ZPropertySheetsClass'
zsheets_class=type(PersistentClass)(
sheet_id,
- tuple(zsheets_base_classes)+(Globals.Persistent,),
+ tuple(zsheets_base_classes)+(Persistent,),
PersistentClassDict(sheet_id, sheet_id))
self.propertysheets=sheets=zsheets_class()
@@ -501,7 +512,7 @@
# Step one, look at all of the methods.
# We can cheat (hee hee) and and look in the _zclass_
# dict for wrapped objects.
- for id in Method.findMethodIds(zclass):
+ for id in findMethodIds(zclass):
r[id]=1
# OK, now lets check out the inherited views:
@@ -555,7 +566,7 @@
for p in c.__ac_permissions__: d[p[0]]=None
r=[]
a=r.append
- for p in AccessControl.Role.gather_permissions(c, [], d): a(p[0])
+ for p in gather_permissions(c, [], d): a(p[0])
r.sort()
return r
@@ -625,7 +636,7 @@
InitializeClass(ZClass)
-class ZClassSheets(OFS.PropertySheets.PropertySheets):
+class ZClassSheets(PropertySheets):
"Manage a collection of property sheets that provide ZClass management"
#isPrincipiaFolderish=1
@@ -635,13 +646,13 @@
"Emulate standard interface for use with navigation"
raise Redirect, URL2+'/manage_workspace'
- views = Basic.ZClassViewsSheet('views')
- basic = Basic.ZClassBasicSheet('basic')
- permissions = Basic.ZClassPermissionsSheet('permissions')
+ views = ZClassViewsSheet('views')
+ basic = ZClassBasicSheet('basic')
+ permissions = ZClassPermissionsSheet('permissions')
def __init__(self):
- self.methods=Method.ZClassMethodsSheet('methods')
- self.common=Property.ZInstanceSheetsSheet('common')
+ self.methods = ZClassMethodsSheet('methods')
+ self.common = ZInstanceSheetsSheet('common')
#
# FTP support
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/ZClassOwner.py
===================================================================
--- Zope/trunk/lib/python/ZClasses/ZClassOwner.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/ZClasses/ZClassOwner.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -12,10 +12,13 @@
##############################################################################
"""Zope Classes
"""
-import ExtensionClass, Globals, ZClass, Products
-from Globals import InitializeClass
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import HTMLFile
+from ExtensionClass import Base
+
def manage_subclassableClassNames(self):
+ import Products
r={}
r.update(Products.meta_class_info)
@@ -26,9 +29,9 @@
r.sort()
return r
-class ZClassOwner(ExtensionClass.Base):
+class ZClassOwner(Base):
- manage_addZClassForm=Globals.HTMLFile(
+ manage_addZClassForm=HTMLFile(
'dtml/addZClass', globals(),
default_class_='OFS.SimpleItem Item',
CreateAFactory=1,
@@ -38,7 +41,8 @@
meta_type='', CreateAFactory=0,
REQUEST=None, zope_object=0):
"Add a ZClass"
- return ZClass.manage_addZClass(
+ from ZClasses.ZClass import manage_addZClass
+ return manage_addZClass(
self, id, title, baseclasses, meta_type, CreateAFactory,
REQUEST, zope_object=zope_object)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Zope2/App/startup.py
===================================================================
--- Zope/trunk/lib/python/Zope2/App/startup.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Zope2/App/startup.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -48,6 +48,9 @@
startup_time = asctime()
def startup():
+ from App.PersistentExtra import patchPersistent
+ patchPersistent()
+
global app
# Import products
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/Zope2/Startup/__init__.py
===================================================================
--- Zope/trunk/lib/python/Zope2/Startup/__init__.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/Zope2/Startup/__init__.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -36,6 +36,42 @@
logger = logging.getLogger("Zope")
started = False
+def stuff_Globals():
+ # Stuff BBB names into the Globals module
+ import Globals
+
+ import TreeDisplay
+ Globals.TreeDisplay = TreeDisplay
+
+ import App.Common
+ Globals.package_home = App.Common.package_home
+ Globals.attrget = App.Common.attrget
+ Globals.Dictionary = App.Common.Dictionary
+
+ from Persistence import Persistent
+ from Persistence import PersistentMapping
+ Globals.Persistent = Persistent
+ Globals.PersistentMapping = PersistentMapping
+
+ from App.class_init import default__class_init__
+ from App.class_init import ApplicationDefaultPermissions
+
+ Globals.InitializeClass = default__class_init__
+
+ from App.special_dtml import HTML
+ from App.special_dtml import HTMLFile
+ from App.special_dtml import DTMLFile
+ Globals.HTML = HTML
+ Globals.HTMLFile = HTMLFile
+ Globals.DTMLFile = DTMLFile
+
+ from App.Dialogs import MessageDialog
+ Globals.MessageDialog = MessageDialog
+
+ from App.ImageFile import ImageFile
+ Globals.ImageFile = ImageFile
+
+
def get_starter():
check_python_version()
if sys.platform[:3].lower() == "win":
@@ -50,6 +86,8 @@
# Don't allow any code to call start_zope() twice.
return
+ stuff_Globals()
+
starter = get_starter()
starter.setConfiguration(cfg)
starter.prepare()
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/webdav/Collection.py
===================================================================
--- Zope/trunk/lib/python/webdav/Collection.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/webdav/Collection.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,17 +17,19 @@
from urllib import unquote
-from Globals import InitializeClass
-from AccessControl import getSecurityManager
-from zExceptions import MethodNotAllowed, NotFound
+from AccessControl.SecurityManagement import getSecurityManager
+from App.class_init import default__class_init__ as InitializeClass
+from zExceptions import MethodNotAllowed
+from zExceptions import NotFound
from zope.interface import implements
-import davcmds
-import Lockable
-from common import Locked, PreconditionFailed
-from common import urlfix, rfc1123_date
-from interfaces import IDAVCollection
-from Resource import Resource
+from webdav.common import Locked
+from webdav.common import PreconditionFailed
+from webdav.common import rfc1123_date
+from webdav.common import urlfix
+from webdav.Lockable import wl_isLocked
+from webdav.interfaces import IDAVCollection
+from webdav.Resource import Resource
class Collection(Resource):
@@ -82,6 +84,7 @@
success, or may return 207 (Multistatus) to indicate partial
success. Note that in Zope a DELETE currently never returns 207."""
+ from webdav.davcmds import DeleteCollection
self.dav__init(REQUEST, RESPONSE)
ifhdr = REQUEST.get_header('If', '')
@@ -97,12 +100,12 @@
# return RESPONSE
# Level 1 of lock checking (is the collection or its parent locked?)
- if Lockable.wl_isLocked(self):
+ if wl_isLocked(self):
if ifhdr:
self.dav__simpleifhandler(REQUEST, RESPONSE, 'DELETE', col=1)
else:
raise Locked
- elif Lockable.wl_isLocked(parent):
+ elif wl_isLocked(parent):
if ifhdr:
parent.dav__simpleifhandler(REQUEST, RESPONSE, 'DELETE', col=1)
else:
@@ -117,7 +120,7 @@
# we just want to get the right token out of the header now
if ifhdr.find(tok) > -1:
token = tok
- cmd = davcmds.DeleteCollection()
+ cmd = DeleteCollection()
result = cmd.apply(self, token, user, REQUEST['URL'])
if result:
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/webdav/LockItem.py
===================================================================
--- Zope/trunk/lib/python/webdav/LockItem.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/webdav/LockItem.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,13 +17,13 @@
import time
-from AccessControl import ClassSecurityInfo
from AccessControl.Owned import ownerInfo
-from Globals import Persistent
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Persistence import Persistent
from zope.interface import implements
-from common import generateLockToken
-from interfaces import ILockItem
+from webdav.common import generateLockToken
+from webdav.interfaces import ILockItem
MAXTIMEOUT = (2L**32)-1 # Maximum timeout time
DEFAULTTIMEOUT = 12 * 60L # Default timeout
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/webdav/Lockable.py
===================================================================
--- Zope/trunk/lib/python/webdav/Lockable.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/webdav/Lockable.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,18 +15,19 @@
$Id$
"""
-import Acquisition
-from AccessControl import ClassSecurityInfo
-from Globals import InitializeClass
-from Globals import PersistentMapping
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from Acquisition import aq_base
+from App.class_init import default__class_init__ as InitializeClass
+from Persistence import PersistentMapping
from zope.interface import implements
-from EtagSupport import EtagSupport
-from interfaces import ILockItem
-from interfaces import IWriteLock
+from webdav.EtagSupport import EtagSupport
+from webdav.interfaces import ILockItem
+from webdav.interfaces import IWriteLock
-class ResourceLockedError(Exception): pass
+class ResourceLockedError(Exception):
+ pass
class LockableItem(EtagSupport):
@@ -72,7 +73,7 @@
for token, lock in locks.items():
if not lock.isValid():
del locks[token]
- if (not locks) and hasattr(Acquisition.aq_base(self),
+ if (not locks) and hasattr(aq_base(self),
'__no_valid_write_locks__'):
self.__no_valid_write_locks__()
return locks
@@ -137,7 +138,7 @@
# Call into a special hook used by LockNullResources to delete
# themselves. Could be used by other objects who want to deal
# with the state of empty locks.
- if hasattr(Acquisition.aq_base(self), '__no_valid_write_locks__'):
+ if hasattr(aq_base(self), '__no_valid_write_locks__'):
self.__no_valid_write_locks__()
InitializeClass(LockableItem)
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/webdav/NullResource.py
===================================================================
--- Zope/trunk/lib/python/webdav/NullResource.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/webdav/NullResource.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -17,31 +17,42 @@
import sys
-import Acquisition
-import OFS.SimpleItem
-from Globals import InitializeClass
-from AccessControl import getSecurityManager
-from AccessControl import ClassSecurityInfo
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.Permissions import view as View
from AccessControl.Permissions import add_folders
from AccessControl.Permissions import webdav_lock_items
from AccessControl.Permissions import webdav_unlock_items
-from Globals import Persistent, DTMLFile
+from Acquisition import aq_base
+from Acquisition import aq_parent
+from Acquisition import Implicit
+from App.class_init import default__class_init__ as InitializeClass
+from App.special_dtml import DTMLFile
+from Persistence import Persistent
from OFS.CopySupport import CopyError
+from OFS.SimpleItem import Item_w__name__
+from zExceptions import BadRequest
+from zExceptions import Forbidden
from zExceptions import MethodNotAllowed
-from zExceptions import Unauthorized, NotFound, Forbidden, BadRequest
+from zExceptions import NotFound
+from zExceptions import Unauthorized
-import davcmds
-from common import aq_base, tokenFinder, IfParser
-from common import isDavCollection
-from common import Locked, Conflict, PreconditionFailed, UnsupportedMediaType
-from interfaces import IWriteLock
-from Resource import Resource
+from webdav.common import Conflict
+from webdav.common import IfParser
+from webdav.common import isDavCollection
+from webdav.common import Locked
+from webdav.common import PreconditionFailed
+from webdav.common import tokenFinder
+from webdav.common import UnsupportedMediaType
+from webdav.davcmds import Lock
+from webdav.davcmds import Unlock
+from webdav.interfaces import IWriteLock
+from webdav.Resource import Resource
from zope.contenttype import guess_content_type
-class NullResource(Persistent, Acquisition.Implicit, Resource):
+class NullResource(Persistent, Implicit, Resource):
"""Null resources are used to handle HTTP method calls on
objects which do not yet exist in the url namespace."""
@@ -233,7 +244,7 @@
parent._setObject(name, locknull)
locknull = parent._getOb(name)
- cmd = davcmds.Lock(REQUEST)
+ cmd = Lock(REQUEST)
token, result = cmd.apply(locknull, creator, depth=depth)
if result:
# Return the multistatus result (there were multiple errors)
@@ -254,7 +265,7 @@
InitializeClass(NullResource)
-class LockNullResource(NullResource, OFS.SimpleItem.Item_w__name__):
+class LockNullResource(NullResource, Item_w__name__):
""" A Lock-Null Resource is created when a LOCK command is succesfully
executed on a NullResource, essentially locking the Name. A PUT or
MKCOL deletes the LockNull resource from its container and replaces it
@@ -278,7 +289,7 @@
# A special hook (for better or worse) called when there are no
# valid locks left. We have to delete ourselves from our container
# now.
- parent = Acquisition.aq_parent(self)
+ parent = aq_parent(self)
if parent: parent._delObject(self.id)
def __init__(self, name):
@@ -344,10 +355,10 @@
else:
raise BadRequest, 'No lock token was submitted in the request'
- cmd = davcmds.Unlock()
+ cmd = Unlock()
result = cmd.apply(self, token, url)
- parent = Acquisition.aq_parent(self)
+ parent = aq_parent(self)
parent._delObject(self.id)
if result:
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/webdav/Resource.py
===================================================================
--- Zope/trunk/lib/python/webdav/Resource.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/webdav/Resource.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -21,9 +21,6 @@
import re
from urllib import unquote
-import webdav
-import ExtensionClass
-from Globals import InitializeClass
from AccessControl import getSecurityManager
from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import delete_objects
@@ -32,32 +29,46 @@
from AccessControl.Permissions import webdav_lock_items
from AccessControl.Permissions import webdav_unlock_items
from AccessControl.Permissions import webdav_access
-from Acquisition import aq_base, aq_inner, aq_parent
-from zExceptions import BadRequest, MethodNotAllowed
-from zExceptions import Unauthorized, Forbidden, NotFound
-from zope.interface import implements
+from Acquisition import aq_base
+from Acquisition import aq_inner
+from Acquisition import aq_parent
+from App.class_init import default__class_init__ as InitializeClass
+from ExtensionClass import Base
+from OFS.event import ObjectClonedEvent
+from OFS.event import ObjectWillBeMovedEvent
+from OFS.subscribers import compatibilityCall
+from zExceptions import BadRequest
+from zExceptions import Forbidden
+from zExceptions import MethodNotAllowed
+from zExceptions import NotFound
+from zExceptions import Unauthorized
from ZPublisher.HTTPRangeSupport import HTTPRangeInterface
-import davcmds
-import Lockable
-from common import absattr, urlfix, rfc1123_date, tokenFinder, urlbase
-from common import IfParser
-from common import isDavCollection
-from common import Locked, Conflict, PreconditionFailed
-from interfaces import IDAVResource
-from interfaces import IWriteLock
-
+from zope.interface import implements
from zope.event import notify
from zope.lifecycleevent import ObjectCopiedEvent
from zope.app.container.contained import ObjectMovedEvent
from zope.app.container.contained import notifyContainerModified
-from OFS.event import ObjectClonedEvent
-from OFS.event import ObjectWillBeMovedEvent
-import OFS.subscribers
+from webdav.Lockable import LockableItem
+from webdav.Lockable import wl_isLockable
+from webdav.Lockable import wl_isLocked
+from webdav.common import absattr
+from webdav.common import Conflict
+from webdav.common import IfParser
+from webdav.common import isDavCollection
+from webdav.common import Locked
+from webdav.common import PreconditionFailed
+from webdav.common import rfc1123_date
+from webdav.common import tokenFinder
+from webdav.common import urlbase
+from webdav.common import urlfix
+from webdav.interfaces import IDAVResource
+from webdav.interfaces import IWriteLock
+
ms_dav_agent = re.compile("Microsoft.*Internet Publishing.*")
-class Resource(ExtensionClass.Base, Lockable.LockableItem):
+class Resource(Base, LockableItem):
"""The Resource mixin class provides basic WebDAV support for
non-collection objects. It provides default implementations
@@ -116,7 +127,7 @@
col=0, url=None, refresh=0):
ifhdr = request.get_header('If', None)
- lockable = Lockable.wl_isLockable(self)
+ lockable = wl_isLockable(self)
if not lockable:
# degenerate case, we shouldnt have even called this method.
return None
@@ -218,6 +229,7 @@
security.declarePublic('OPTIONS')
def OPTIONS(self, REQUEST, RESPONSE):
"""Retrieve communication options."""
+ import webdav
self.dav__init(REQUEST, RESPONSE)
RESPONSE.setHeader('Allow', ', '.join(self.__http_methods__))
RESPONSE.setHeader('Content-Length', 0)
@@ -255,7 +267,7 @@
name = unquote(filter(None, url.split( '/')[-1]))
parent = aq_parent(aq_inner(self))
# Lock checking
- if Lockable.wl_isLocked(self):
+ if wl_isLocked(self):
if ifhdr:
self.dav__simpleifhandler(REQUEST, RESPONSE, 'DELETE')
else:
@@ -285,9 +297,10 @@
security.declareProtected(webdav_access, 'PROPFIND')
def PROPFIND(self, REQUEST, RESPONSE):
"""Retrieve properties defined on the resource."""
+ from webdav.davcmds import PropFind
self.dav__init(REQUEST, RESPONSE)
- cmd=davcmds.PropFind(REQUEST)
- result=cmd.apply(self)
+ cmd = PropFind(REQUEST)
+ result = cmd.apply(self)
# work around MSIE DAV bug for creation and modified date
if (REQUEST.get_header('User-Agent') ==
'Microsoft Data Access Internet Publishing Provider DAV 1.1'):
@@ -303,20 +316,21 @@
security.declareProtected(manage_properties, 'PROPPATCH')
def PROPPATCH(self, REQUEST, RESPONSE):
"""Set and/or remove properties defined on the resource."""
+ from webdav.davcmds import PropPatch
self.dav__init(REQUEST, RESPONSE)
if not hasattr(aq_base(self), 'propertysheets'):
raise MethodNotAllowed, (
'Method not supported for this resource.')
# Lock checking
ifhdr = REQUEST.get_header('If', '')
- if Lockable.wl_isLocked(self):
+ if wl_isLocked(self):
if ifhdr:
self.dav__simpleifhandler(REQUEST, RESPONSE, 'PROPPATCH')
else:
raise Locked, 'Resource is locked.'
- cmd=davcmds.PropPatch(REQUEST)
- result=cmd.apply(self)
+ cmd = PropPatch(REQUEST)
+ result = cmd.apply(self)
RESPONSE.setStatus(207)
RESPONSE.setHeader('Content-Type', 'text/xml; charset="utf-8"')
RESPONSE.setBody(result)
@@ -425,7 +439,7 @@
ob = parent._getOb(name)
ob._postCopy(parent, op=0)
- OFS.subscribers.compatibilityCall('manage_afterClone', ob, ob)
+ compatibilityCall('manage_afterClone', ob, ob)
notify(ObjectClonedEvent(ob))
@@ -510,7 +524,7 @@
raise PreconditionFailed, 'Condition failed.'
else:
raise Locked, 'Destination is locked.'
- if Lockable.wl_isLocked(self):
+ if wl_isLocked(self):
# Lastly, we check ourselves
if ifhdr:
itrue = self.dav__simpleifhandler(REQUEST, RESPONSE, 'MOVE',
@@ -567,13 +581,14 @@
security.declareProtected(webdav_lock_items, 'LOCK')
def LOCK(self, REQUEST, RESPONSE):
"""Lock a resource"""
+ from webdav.davcmds import Lock
self.dav__init(REQUEST, RESPONSE)
security = getSecurityManager()
creator = security.getUser()
body = REQUEST.get('BODY', '')
ifhdr = REQUEST.get_header('If', None)
depth = REQUEST.get_header('Depth', 'infinity')
- alreadylocked = Lockable.wl_isLocked(self)
+ alreadylocked = wl_isLocked(self)
if body and alreadylocked:
# This is a full LOCK request, and the Resource is
@@ -582,7 +597,7 @@
RESPONSE.setStatus(423)
elif body:
# This is a normal lock request with an XML payload
- cmd = davcmds.Lock(REQUEST)
+ cmd = Lock(REQUEST)
token, result = cmd.apply(self, creator, depth=depth)
if result:
# Return the multistatus result (there were multiple
@@ -627,13 +642,14 @@
security.declareProtected(webdav_unlock_items, 'UNLOCK')
def UNLOCK(self, REQUEST, RESPONSE):
"""Remove an existing lock on a resource."""
+ from webdav.davcmds import Unlock
self.dav__init(REQUEST, RESPONSE)
security = getSecurityManager()
token = REQUEST.get_header('Lock-Token', '')
url = REQUEST['URL']
token = tokenFinder(token)
- cmd = davcmds.Unlock()
+ cmd = Unlock()
result = cmd.apply(self, token, url)
if result:
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/webdav/common.py
===================================================================
--- Zope/trunk/lib/python/webdav/common.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/webdav/common.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -15,11 +15,16 @@
__version__='$Revision: 1.18 $'[11:-2]
-import time, urllib, re
-from App.Common import iso8601_date, rfc850_date, rfc1123_date
-from App.Common import aq_base
import random
+import re
+import time
+import urllib
+from Acquisition import aq_base
+from App.Common import iso8601_date
+from App.Common import rfc1123_date
+from App.Common import rfc850_date
+
_randGen = random.Random(time.time())
class WebDAVException(Exception):
Modified: Zope/branches/tseaver-no_globals_imports/lib/python/webdav/davcmds.py
===================================================================
--- Zope/trunk/lib/python/webdav/davcmds.py 2008-12-26 14:09:49 UTC (rev 94346)
+++ Zope/branches/tseaver-no_globals_imports/lib/python/webdav/davcmds.py 2008-12-27 03:27:23 UTC (rev 94367)
@@ -20,17 +20,22 @@
from urllib import quote
import transaction
-from AccessControl import getSecurityManager
+from AccessControl.SecurityManagement import getSecurityManager
+from Acquisition import aq_base
from Acquisition import aq_parent
from OFS.PropertySheets import DAVProperties
-from zExceptions import BadRequest, Forbidden
+from zExceptions import BadRequest
+from zExceptions import Forbidden
-from common import absattr, aq_base, urlfix, urlbase, urljoin
-from common import isDavCollection
-from common import PreconditionFailed
-from interfaces import IWriteLock
-from LockItem import LockItem
-from xmltools import XmlParser
+from webdav.common import absattr
+from webdav.common import urlbase
+from webdav.common import urlfix
+from webdav.common import urljoin
+from webdav.common import isDavCollection
+from webdav.common import PreconditionFailed
+from webdav.interfaces import IWriteLock
+from webdav.LockItem import LockItem
+from webdav.xmltools import XmlParser
def safe_quote(url, mark=r'%'):
More information about the Zope-Checkins
mailing list