[CMF-checkins] SVN: CMF/trunk/ - reverted part of the
tools-as-utilities changes:
Yvo Schubbe
y.2007- at wcm-solutions.de
Thu Jun 21 08:59:19 EDT 2007
Log message for revision 76897:
- reverted part of the tools-as-utilities changes:
portal_actions, portal_catalog, content_type_registry, cookie_authentication, portal_skins, portal_types, portal_url, portal_workflow and portal_uidhandler depend currently on self.REQUEST which is not available in utilities.
- added XXX comments to methods that need to be adjusted first
Changed:
U CMF/trunk/CMFCore/ActionsTool.py
U CMF/trunk/CMFCore/CMFCatalogAware.py
U CMF/trunk/CMFCore/CatalogTool.py
U CMF/trunk/CMFCore/ContentTypeRegistry.py
U CMF/trunk/CMFCore/CookieCrumbler.py
U CMF/trunk/CMFCore/DiscussionTool.py
U CMF/trunk/CMFCore/DynamicType.py
U CMF/trunk/CMFCore/FSObject.py
U CMF/trunk/CMFCore/PortalFolder.py
U CMF/trunk/CMFCore/PortalObject.py
U CMF/trunk/CMFCore/Skinnable.py
U CMF/trunk/CMFCore/SkinsTool.py
U CMF/trunk/CMFCore/TypesTool.py
U CMF/trunk/CMFCore/URLTool.py
U CMF/trunk/CMFCore/WorkflowTool.py
U CMF/trunk/CMFCore/exportimport/actions.py
U CMF/trunk/CMFCore/exportimport/catalog.py
U CMF/trunk/CMFCore/exportimport/content.py
U CMF/trunk/CMFCore/exportimport/contenttyperegistry.py
U CMF/trunk/CMFCore/exportimport/cookieauth.py
U CMF/trunk/CMFCore/exportimport/skins.py
U CMF/trunk/CMFCore/exportimport/tests/test_actions.py
U CMF/trunk/CMFCore/exportimport/tests/test_catalog.py
U CMF/trunk/CMFCore/exportimport/tests/test_content.py
U CMF/trunk/CMFCore/exportimport/tests/test_contenttyperegistry.py
U CMF/trunk/CMFCore/exportimport/tests/test_cookieauth.py
U CMF/trunk/CMFCore/exportimport/tests/test_skins.py
U CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py
U CMF/trunk/CMFCore/exportimport/tests/test_workflow.py
U CMF/trunk/CMFCore/exportimport/typeinfo.py
U CMF/trunk/CMFCore/exportimport/workflow.py
U CMF/trunk/CMFCore/tests/base/dummy.py
U CMF/trunk/CMFCore/tests/test_ActionsTool.py
U CMF/trunk/CMFCore/tests/test_CMFCatalogAware.py
U CMF/trunk/CMFCore/tests/test_CachingPolicyManager.py
U CMF/trunk/CMFCore/tests/test_DynamicType.py
U CMF/trunk/CMFCore/tests/test_FSDTMLMethod.py
U CMF/trunk/CMFCore/tests/test_FSPageTemplate.py
U CMF/trunk/CMFCore/tests/test_FSPropertiesObject.py
U CMF/trunk/CMFCore/tests/test_FSPythonScript.py
U CMF/trunk/CMFCore/tests/test_FSReSTMethod.py
U CMF/trunk/CMFCore/tests/test_FSSTXMethod.py
U CMF/trunk/CMFCore/tests/test_FSZSQLMethod.py
U CMF/trunk/CMFCore/tests/test_OpaqueItems.py
U CMF/trunk/CMFCore/tests/test_PortalContent.py
U CMF/trunk/CMFCore/tests/test_PortalFolder.py
U CMF/trunk/CMFCore/tests/test_SkinsTool.py
U CMF/trunk/CMFCore/tests/test_WorkflowTool.py
U CMF/trunk/CMFDefault/DefaultWorkflow.py
U CMF/trunk/CMFDefault/DiscussionTool.py
U CMF/trunk/CMFDefault/Extensions/update_catalogIndexes.py
U CMF/trunk/CMFDefault/Favorite.py
U CMF/trunk/CMFDefault/browser/favorite.py
U CMF/trunk/CMFDefault/browser/folder.py
U CMF/trunk/CMFDefault/browser/folder.txt
U CMF/trunk/CMFDefault/browser/metadata.py
U CMF/trunk/CMFDefault/browser/utils.py
U CMF/trunk/CMFDefault/formlib/form.py
U CMF/trunk/CMFDefault/profiles/default/componentregistry.xml
U CMF/trunk/CMFDefault/skins/zpt_content/content_status_modify.py
U CMF/trunk/CMFDefault/skins/zpt_control/setRedirect.py
U CMF/trunk/CMFDefault/skins/zpt_generic/breadcrumbs.py
U CMF/trunk/CMFDefault/skins/zpt_generic/discussion_reply_form.py
U CMF/trunk/CMFDefault/skins/zpt_generic/expanded_title.py
U CMF/trunk/CMFDefault/skins/zpt_generic/folder_contents.py
U CMF/trunk/CMFDefault/skins/zpt_generic/folder_rename_form.py
U CMF/trunk/CMFDefault/skins/zpt_generic/getBatchItemInfos.py
U CMF/trunk/CMFDefault/skins/zpt_generic/getMainGlobals.py
U CMF/trunk/CMFDefault/skins/zpt_generic/get_permalink.py
U CMF/trunk/CMFDefault/skins/zpt_generic/join_form.py
U CMF/trunk/CMFDefault/skins/zpt_generic/logged_in.py
U CMF/trunk/CMFDefault/skins/zpt_generic/members_delete_form.py
U CMF/trunk/CMFDefault/skins/zpt_generic/members_manage_form.py
U CMF/trunk/CMFDefault/skins/zpt_generic/news_box.py
U CMF/trunk/CMFDefault/skins/zpt_generic/password_email.py
U CMF/trunk/CMFDefault/skins/zpt_generic/password_form.py
U CMF/trunk/CMFDefault/skins/zpt_generic/recent_news.py
U CMF/trunk/CMFDefault/skins/zpt_generic/reconfig_form.py
U CMF/trunk/CMFDefault/skins/zpt_generic/registered_email.py
U CMF/trunk/CMFDefault/skins/zpt_generic/rejectItems.py
U CMF/trunk/CMFDefault/skins/zpt_generic/search.py
U CMF/trunk/CMFDefault/skins/zpt_generic/search_form.py
U CMF/trunk/CMFDefault/skins/zpt_generic/setup_talkback_tree.py
U CMF/trunk/CMFDefault/tests/test_DiscussionTool.py
U CMF/trunk/CMFDefault/tests/test_Discussions.py
U CMF/trunk/CMFDefault/tests/test_Favorite.py
U CMF/trunk/CMFDefault/tests/test_MembershipTool.py
U CMF/trunk/CMFDefault/tests/test_Portal.py
U CMF/trunk/CMFDefault/tests/test_SyndicationTool.py
U CMF/trunk/CMFTopic/Topic.py
U CMF/trunk/CMFTopic/tests/test_Topic.py
U CMF/trunk/CMFUid/UniqueIdAnnotationTool.py
U CMF/trunk/CMFUid/UniqueIdHandlerTool.py
U CMF/trunk/CMFUid/profiles/default/componentregistry.xml
U CMF/trunk/CMFUid/tests/test_uidannotation.py
U CMF/trunk/CMFUid/tests/test_uidhandling.py
U CMF/trunk/DCWorkflow/DCWorkflow.py
U CMF/trunk/DCWorkflow/tests/test_exportimport.py
-=-
Modified: CMF/trunk/CMFCore/ActionsTool.py
===================================================================
--- CMF/trunk/CMFCore/ActionsTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/ActionsTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -28,7 +28,6 @@
from interfaces import IActionsTool
from permissions import ManagePortal
from utils import _dtmldir
-from utils import registerToolInterface
from utils import UniqueObject
@@ -39,6 +38,8 @@
Weave together the various sources of "actions" which are apropos
to the current user and context.
"""
+ # XXX: this class violates the rules for tools/utilities:
+ # ActionProviderBase depends implicitly on REQUEST
implements(IActionsTool)
@@ -178,4 +179,3 @@
return filtered_actions
InitializeClass(ActionsTool)
-registerToolInterface('portal_actions', IActionsTool)
Modified: CMF/trunk/CMFCore/CMFCatalogAware.py
===================================================================
--- CMF/trunk/CMFCore/CMFCatalogAware.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/CMFCatalogAware.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -26,17 +26,15 @@
from OFS.interfaces import IObjectWillBeMovedEvent
from zope.app.container.interfaces import IObjectAddedEvent
from zope.app.container.interfaces import IObjectMovedEvent
-from zope.component import queryUtility
from zope.component import subscribers
from interfaces import ICallableOpaqueItem
-from interfaces import ICatalogTool
-from interfaces import IConfigurableWorkflowTool
from permissions import AccessContentsInformation
from permissions import ManagePortal
from permissions import ModifyPortalContent
from utils import _dtmldir
from utils import _getAuthenticatedUser
+from utils import getToolByName
logger = logging.getLogger('CMFCore.CMFCatalogAware')
@@ -53,10 +51,10 @@
# for a given content type
def _getCatalogTool(self):
- return queryUtility(ICatalogTool)
+ return getToolByName(self, 'portal_catalog', None)
def _getWorkflowTool(self):
- return queryUtility(IConfigurableWorkflowTool)
+ return getToolByName(self, 'portal_workflow', None)
# Cataloging methods
# ------------------
Modified: CMF/trunk/CMFCore/CatalogTool.py
===================================================================
--- CMF/trunk/CMFCore/CatalogTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/CatalogTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -24,7 +24,6 @@
from Globals import InitializeClass
from Products.PluginIndexes.common import safe_callable
from Products.ZCatalog.ZCatalog import ZCatalog
-from zope.component import queryUtility
from zope.interface import implements
from zope.interface import providedBy
from zope.interface.declarations import getObjectSpecification
@@ -33,7 +32,6 @@
from ActionProviderBase import ActionProviderBase
from interfaces import ICatalogTool
-from interfaces import IConfigurableWorkflowTool
from interfaces import IIndexableObjectWrapper
from permissions import AccessInactivePortalContent
from permissions import ManagePortal
@@ -42,7 +40,7 @@
from utils import _dtmldir
from utils import _getAuthenticatedUser
from utils import _mergedLocalRoles
-from utils import registerToolInterface
+from utils import getToolByName
from utils import UniqueObject
@@ -246,7 +244,9 @@
pghandler=None):
# Wraps the object with workflow and accessibility
# information just before cataloging.
- wftool = queryUtility(IConfigurableWorkflowTool)
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on a non-utility tool
+ wftool = getToolByName(self, 'portal_workflow', None)
if wftool is not None:
vars = wftool.getCatalogVariablesFor(obj)
else:
@@ -291,4 +291,3 @@
self.catalog_object(object, uid, idxs, update_metadata)
InitializeClass(CatalogTool)
-registerToolInterface('portal_catalog', ICatalogTool)
Modified: CMF/trunk/CMFCore/ContentTypeRegistry.py
===================================================================
--- CMF/trunk/CMFCore/ContentTypeRegistry.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/ContentTypeRegistry.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -22,16 +22,14 @@
from Globals import InitializeClass
from Globals import PersistentMapping
from OFS.SimpleItem import SimpleItem
-from zope.component import getUtility
from zope.interface import implements
from ZPublisher.mapply import mapply
from interfaces import IContentTypeRegistry
from interfaces import IContentTypeRegistryPredicate
-from interfaces import ITypesTool
from permissions import ManagePortal
from utils import _dtmldir
-from utils import registerToolInterface
+from utils import getToolByName
class MajorMinorPredicate( SimpleItem ):
@@ -433,11 +431,13 @@
def doTestRegistry( self, name, content_type, body, REQUEST ):
"""
"""
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on a non-utility tool
typeName = self.findTypeName( name, content_type, body )
if typeName is None:
typeName = '<unknown>'
else:
- types_tool = getUtility(ITypesTool)
+ types_tool = getToolByName(self, 'portal_types')
typeName = types_tool.getTypeInfo(typeName).Title()
REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
+ '/manage_testRegistry'
@@ -550,8 +550,8 @@
return None
InitializeClass( ContentTypeRegistry )
-registerToolInterface('content_type_registry', IContentTypeRegistry)
+
def manage_addRegistry( self, REQUEST=None ):
"""
Add a CTR to self.
Modified: CMF/trunk/CMFCore/CookieCrumbler.py
===================================================================
--- CMF/trunk/CMFCore/CookieCrumbler.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/CookieCrumbler.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -32,7 +32,6 @@
from OFS.interfaces import IObjectWillBeMovedEvent
from interfaces import ICookieCrumbler
-from utils import registerToolInterface
# Constants.
@@ -131,6 +130,8 @@
security.declarePrivate('defaultSetAuthCookie')
def defaultSetAuthCookie(self, resp, cookie_name, cookie_value):
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on self.REQUEST
kw = {}
req = getattr(self, 'REQUEST', None)
if req is not None and req.get('SERVER_URL', '').startswith('https:'):
@@ -233,7 +234,7 @@
def __call__(self, container, req):
'''The __before_publishing_traverse__ hook.'''
- resp = self.REQUEST['RESPONSE']
+ resp = req['RESPONSE']
try:
attempt = self.modifyRequest(req, resp)
except CookieCrumblerDisabled:
@@ -267,6 +268,8 @@
security.declarePublic('credentialsChanged')
def credentialsChanged(self, user, name, pw):
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on self.REQUEST
ac = encodestring('%s:%s' % (name, pw)).rstrip()
method = self.getCookieMethod( 'setAuthCookie'
, self.defaultSetAuthCookie )
@@ -274,6 +277,8 @@
method( resp, self.auth_cookie, quote( ac ) )
def _cleanupResponse(self):
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on self.REQUEST
resp = self.REQUEST['RESPONSE']
# No errors of any sort may propagate, and we don't care *what*
# they are, even to log them.
@@ -315,6 +320,8 @@
'''
Redirects to the login page.
'''
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on self.REQUEST
req = self.REQUEST
resp = req['RESPONSE']
attempt = getattr(req, '_cookie_auth', ATTEMPT_NONE)
@@ -359,6 +366,8 @@
'''
Logs out the user and redirects to the logout page.
'''
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on self.REQUEST
req = self.REQUEST
resp = req['RESPONSE']
method = self.getCookieMethod( 'expireAuthCookie'
@@ -383,8 +392,8 @@
return id
Globals.InitializeClass(CookieCrumbler)
-registerToolInterface('cookie_authentication', ICookieCrumbler)
+
def handleCookieCrumblerEvent(ob, event):
""" Event subscriber for (un)registering a CC as a before traverse hook.
"""
Modified: CMF/trunk/CMFCore/DiscussionTool.py
===================================================================
--- CMF/trunk/CMFCore/DiscussionTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/DiscussionTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -27,16 +27,15 @@
from zope.interface import implements
from ActionProviderBase import ActionProviderBase
-from interfaces import ICatalogTool
from interfaces import IMembershipTool
from interfaces import IOldstyleDiscussable
from interfaces import IOldstyleDiscussionTool
-from interfaces import ITypesTool
from permissions import AccessContentsInformation
from permissions import ManagePortal
from permissions import ReplyToItem
from permissions import View
from utils import _dtmldir
+from utils import getToolByName
from utils import UniqueObject
@@ -92,7 +91,7 @@
Often, the actual objects are not needed. This is less expensive
than fetching the objects.
"""
- catalog = getUtility(ICatalogTool)
+ catalog = getToolByName(self.content, 'portal_catalog')
return catalog.searchResults(in_reply_to=
urllib.unquote('/'+self.absolute_url(1)))
@@ -102,7 +101,7 @@
Return a sequence of the DiscussionResponse objects which are
associated with this Discussable
"""
- catalog = getUtility(ICatalogTool)
+ catalog = getToolByName(self.content, 'portal_catalog')
results = self.getReplyResults()
rids = map(lambda x: x.data_record_id_, results)
objects = map(catalog.getobject, rids)
@@ -154,7 +153,7 @@
'''
if hasattr( content, 'allow_discussion' ):
return content.allow_discussion
- typeInfo = getUtility(ITypesTool).getTypeInfo( content )
+ typeInfo = content.getTypeInfo()
if typeInfo:
return typeInfo.allowDiscussion()
return 0
Modified: CMF/trunk/CMFCore/DynamicType.py
===================================================================
--- CMF/trunk/CMFCore/DynamicType.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/DynamicType.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -20,14 +20,11 @@
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass
from zope.app.publisher.browser import queryDefaultViewName
-from zope.component import getUtility
from zope.component import queryMultiAdapter
-from zope.component import queryUtility
from zope.interface import implements
from interfaces import IDynamicType
-from interfaces import ITypesTool
-from interfaces import IURLTool
+from utils import getToolByName
class DynamicType:
@@ -67,7 +64,7 @@
def getTypeInfo(self):
""" Get the TypeInformation object specified by the portal type.
"""
- tool = queryUtility(ITypesTool)
+ tool = getToolByName(self, 'portal_types', None)
if tool is None:
return None
return tool.getTypeInfo(self) # Can return None.
@@ -103,7 +100,7 @@
return icon
else:
# Relative to REQUEST['BASEPATH1']
- portal_url = getUtility(IURLTool)
+ portal_url = getToolByName( self, 'portal_url' )
res = portal_url(relative=1) + '/' + icon
while res[:1] == '/':
res = res[1:]
Modified: CMF/trunk/CMFCore/FSObject.py
===================================================================
--- CMF/trunk/CMFCore/FSObject.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/FSObject.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -28,15 +28,12 @@
from DateTime import DateTime
from OFS.Cache import Cacheable
from OFS.SimpleItem import Item
-
-from zope.component import getUtility
-
from Products.PythonScripts.standard import html_quote
-from interfaces import ISkinsTool
from permissions import ManagePortal
from permissions import View
from permissions import ViewManagementScreens
+from utils import getToolByName
class FSObject(Implicit, Item, RoleManager, Cacheable):
@@ -118,10 +115,16 @@
# The permission was invalid, never mind
pass
+ skins_tool_namegetter = getattr(self, 'getSkinsFolderName', None)
+ if skins_tool_namegetter is not None:
+ skins_tool_name = skins_tool_namegetter()
+ else:
+ skins_tool_name = 'portal_skins'
+
id = obj.getId()
fpath = tuple( folder_path.split('/') )
if root is None:
- portal_skins = getUtility(ISkinsTool)
+ portal_skins = getToolByName(self, skins_tool_name)
else:
portal_skins = root
if folder_path == '.':
Modified: CMF/trunk/CMFCore/PortalFolder.py
===================================================================
--- CMF/trunk/CMFCore/PortalFolder.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/PortalFolder.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -26,8 +26,6 @@
from Globals import InitializeClass
from OFS.Folder import Folder
from OFS.OrderSupport import OrderSupport
-from zope.component import getUtility
-from zope.component import queryUtility
from zope.component.factory import Factory
from zope.interface import implements
@@ -36,11 +34,9 @@
from exceptions import AccessControl_Unauthorized
from exceptions import BadRequest
from exceptions import zExceptions_Unauthorized
-from interfaces import IContentTypeRegistry
from interfaces import IFolderish
from interfaces import IMutableMinimalDublinCore
from interfaces import ISiteRoot
-from interfaces import ITypesTool
from permissions import AddPortalContent
from permissions import AddPortalFolders
from permissions import DeleteObjects
@@ -49,6 +45,7 @@
from permissions import ManageProperties
from permissions import View
from utils import _checkPermission
+from utils import getToolByName
class PortalFolderBase(DynamicType, CMFCatalogAware, Folder):
@@ -123,7 +120,7 @@
this folder.
"""
result = []
- portal_types = getUtility(ITypesTool)
+ portal_types = getToolByName(self, 'portal_types')
myType = portal_types.getTypeInfo(self)
if myType is not None:
@@ -151,7 +148,7 @@
pt = filt.get('portal_type', [])
if isinstance(pt, basestring):
pt = [pt]
- types_tool = getUtility(ITypesTool)
+ types_tool = getToolByName(self, 'portal_types')
allowed_types = types_tool.listContentTypes()
if not pt:
pt = allowed_types
@@ -282,7 +279,7 @@
Returns -- Bare and empty object of the appropriate type (or None, if
we don't know what to do)
"""
- registry = queryUtility(IContentTypeRegistry)
+ registry = getToolByName(self, 'content_type_registry', None)
if registry is None:
return None
@@ -301,7 +298,7 @@
def invokeFactory(self, type_name, id, RESPONSE=None, *args, **kw):
""" Invokes the portal_types tool.
"""
- pt = getUtility(ITypesTool)
+ pt = getToolByName(self, 'portal_types')
myType = pt.getTypeInfo(self)
if myType is not None:
@@ -432,7 +429,7 @@
if type_name is not None:
- pt = getUtility(ITypesTool)
+ pt = getToolByName(self, 'portal_types')
myType = pt.getTypeInfo(self)
if myType is not None and not myType.allowType(type_name):
Modified: CMF/trunk/CMFCore/PortalObject.py
===================================================================
--- CMF/trunk/CMFCore/PortalObject.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/PortalObject.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -15,8 +15,6 @@
$Id$
"""
-from warnings import warn
-
from five.localsitemanager import find_next_sitemanager
from five.localsitemanager.registry import PersistentComponents
from Globals import InitializeClass
@@ -59,9 +57,6 @@
)
def getSkinsFolderName(self):
- warn('getSkinsFolderName is deprecated and will be removed in '
- 'CMF 2.3, please use "getUtility(ISkinsTool)" to retrieve '
- 'the skins tool object.', DeprecationWarning, stacklevel=2)
return PORTAL_SKINS_TOOL_ID
def getSiteManager(self):
Modified: CMF/trunk/CMFCore/Skinnable.py
===================================================================
--- CMF/trunk/CMFCore/Skinnable.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/Skinnable.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -21,7 +21,6 @@
import logging
from thread import get_ident
from warnings import warn
-from zope.component import getSiteManager
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
@@ -29,10 +28,6 @@
from OFS.ObjectManager import ObjectManager
from ZODB.POSException import ConflictError
-from zope.component import queryUtility
-
-from Products.CMFCore.interfaces import ISkinsTool
-
logger = logging.getLogger('CMFCore.Skinnable')
@@ -70,9 +65,6 @@
security.declarePrivate('getSkinsFolderName')
def getSkinsFolderName(self):
# Not implemented.
- warn('getSkinsFolderName is deprecated and will be removed in '
- 'CMF 2.3, please use "getUtility(ISkinsTool)" to retrieve '
- 'the skins tool object.', DeprecationWarning, stacklevel=2)
return None
def __getattr__(self, name):
@@ -108,26 +100,28 @@
"""Returns the requested skin.
"""
skinob = None
- sf = queryUtility(ISkinsTool)
+ sfn = self.getSkinsFolderName()
- if sf is not None:
- if name is not None:
- skinob = sf.getSkinByName(name)
- if skinob is None:
- skinob = sf.getSkinByName(sf.getDefaultSkin())
+ if sfn is not None:
+ sf = getattr(self, sfn, None)
+ if sf is not None:
+ if name is not None:
+ skinob = sf.getSkinByName(name)
if skinob is None:
- skinob = sf.getSkinByPath('')
-
+ skinob = sf.getSkinByName(sf.getDefaultSkin())
+ if skinob is None:
+ skinob = sf.getSkinByPath('')
return skinob
security.declarePublic('getSkinNameFromRequest')
def getSkinNameFromRequest(self, REQUEST=None):
'''Returns the skin name from the Request.'''
- sf = queryUtility(ISkinsTool)
+ sfn = self.getSkinsFolderName()
+ if sfn is not None:
+ sf = getattr(self, sfn, None)
+ if sf is not None:
+ return REQUEST.get(sf.getRequestVarname(), None)
- if sf is not None:
- return REQUEST.get(sf.getRequestVarname(), None)
-
security.declarePublic('changeSkin')
def changeSkin(self, skinname, REQUEST=_MARKER):
'''Change the current skin.
@@ -157,9 +151,11 @@
if skinname is not None:
return skinname
# nothing here, so assume the default skin
- sf = queryUtility(ISkinsTool)
- if sf is not None:
- return sf.getDefaultSkin()
+ sfn = self.getSkinsFolderName()
+ if sfn is not None:
+ sf = getattr(self, sfn, None)
+ if sf is not None:
+ return sf.getDefaultSkin()
# and if that fails...
return None
Modified: CMF/trunk/CMFCore/SkinsTool.py
===================================================================
--- CMF/trunk/CMFCore/SkinsTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/SkinsTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -36,13 +36,12 @@
from DirectoryView import ignore_re
from interfaces import IMembershipTool
from interfaces import ISkinsTool
-from interfaces import IURLTool
from permissions import AccessContentsInformation
from permissions import ManagePortal
from permissions import View
from SkinsContainer import SkinsContainer
from utils import _dtmldir
-from utils import registerToolInterface
+from utils import getToolByName
from utils import UniqueObject
def modifiedOptions():
@@ -304,8 +303,10 @@
def updateSkinCookie(self):
""" If needed, updates the skin cookie based on the member preference.
"""
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on a non-utility tool and uses self.REQUEST
mtool = getUtility(IMembershipTool)
- utool = getUtility(IURLTool)
+ utool = getToolByName(self, 'portal_url')
member = mtool.getAuthenticatedMember()
if hasattr(aq_base(member), 'portal_skin'):
mskin = member.portal_skin
@@ -338,9 +339,11 @@
def clearSkinCookie(self):
""" Expire the skin cookie.
"""
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on a non-utility tool and uses self.REQUEST
req = self.REQUEST
resp = req.RESPONSE
- utool = getUtility(IURLTool)
+ utool = getToolByName(self, 'portal_url')
portal_path = req['BASEPATH1'] + '/' + utool(1)
resp.expireCookie(self.request_varname, path=portal_path)
@@ -370,4 +373,3 @@
self.default_skin = skinname
InitializeClass(SkinsTool)
-registerToolInterface('portal_skins', ISkinsTool)
Modified: CMF/trunk/CMFCore/TypesTool.py
===================================================================
--- CMF/trunk/CMFCore/TypesTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/TypesTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -46,7 +46,6 @@
from utils import _checkPermission
from utils import _dtmldir
from utils import _wwwdir
-from utils import registerToolInterface
from utils import SimpleItemWithProperties
from utils import UniqueObject
@@ -432,6 +431,8 @@
Returns the object without calling _finishConstruction().
"""
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on self.REQUEST
id = str(id)
if self.product:
@@ -744,4 +745,3 @@
return rval
InitializeClass(TypesTool)
-registerToolInterface('portal_types', ITypesTool)
Modified: CMF/trunk/CMFCore/URLTool.py
===================================================================
--- CMF/trunk/CMFCore/URLTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/URLTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -30,7 +30,6 @@
from permissions import ManagePortal
from permissions import View
from utils import _dtmldir
-from utils import registerToolInterface
from utils import UniqueObject
@@ -68,6 +67,8 @@
def __call__(self, relative=0, *args, **kw):
""" Get by default the absolute URL of the portal.
"""
+ # XXX: this method violates the rules for tools/utilities:
+ # absolute_url() depends implicitly on REQUEST
return self.getPortalObject().absolute_url(relative=relative)
security.declarePublic('getPortalObject')
@@ -104,4 +105,3 @@
return '/'.join( self.getPortalObject().getPhysicalPath() )
InitializeClass(URLTool)
-registerToolInterface('portal_url', IURLTool)
Modified: CMF/trunk/CMFCore/WorkflowTool.py
===================================================================
--- CMF/trunk/CMFCore/WorkflowTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/WorkflowTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -25,19 +25,17 @@
from Globals import PersistentMapping
from OFS.Folder import Folder
from OFS.ObjectManager import IFAwareObjectManager
-from zope.component import queryUtility
from zope.event import notify
from zope.interface import implements
from ActionProviderBase import ActionProviderBase
from interfaces import IConfigurableWorkflowTool
-from interfaces import ITypesTool
from interfaces import IWorkflowDefinition
from interfaces import IWorkflowTool
from permissions import ManagePortal
from utils import _dtmldir
+from utils import getToolByName
from utils import Message as _
-from utils import registerToolInterface
from utils import UniqueObject
from WorkflowCore import ActionRaisedExceptionEvent
from WorkflowCore import ActionSucceededEvent
@@ -478,7 +476,9 @@
def getDefaultChainFor(self, ob):
""" Get the default chain, if applicable, for ob.
"""
- types_tool = queryUtility(ITypesTool)
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on a non-utility tool
+ types_tool = getToolByName( self, 'portal_types', None )
if ( types_tool is not None
and types_tool.getTypeInfo( ob ) is not None ):
return self._default_chain
@@ -526,7 +526,9 @@
""" List the portal types which are available.
"""
- pt = queryUtility(ITypesTool)
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on a non-utility tool
+ pt = getToolByName(self, 'portal_types', None)
if pt is None:
return ()
else:
@@ -633,4 +635,3 @@
ob.reindexObjectSecurity()
InitializeClass(WorkflowTool)
-registerToolInterface('portal_workflow', IWorkflowTool)
Modified: CMF/trunk/CMFCore/exportimport/actions.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/actions.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/actions.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -16,8 +16,6 @@
"""
from zope.component import adapts
-from zope.component import getSiteManager
-from zope.component import getUtility
from Products.GenericSetup.interfaces import ISetupEnviron
from Products.GenericSetup.utils import exportObjects
@@ -32,7 +30,7 @@
from Products.CMFCore.interfaces import IActionCategory
from Products.CMFCore.interfaces import IActionProvider
from Products.CMFCore.interfaces import IActionsTool
-from Products.CMFCore.utils import getToolInterface
+from Products.CMFCore.utils import getToolByName
_SPECIAL_PROVIDERS = ('portal_actions', 'portal_types', 'portal_workflow')
@@ -145,9 +143,8 @@
def _extractOldstyleActions(self, provider_id):
# BBB: for CMF 1.6 profiles
fragment = self._doc.createDocumentFragment()
- provider_iface = getToolInterface(provider_id)
- provider = getUtility(provider_iface)
+ provider = getToolByName(self.context, provider_id)
if not IActionProvider.providedBy(provider):
return fragment
@@ -246,16 +243,16 @@
def importActionProviders(context):
"""Import actions tool.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.getUtility(IActionsTool)
+ site = context.getSite()
+ tool = getToolByName(site, 'portal_actions')
importObjects(tool, '', context)
def exportActionProviders(context):
"""Export actions tool.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.queryUtility(IActionsTool)
+ site = context.getSite()
+ tool = getToolByName(site, 'portal_actions', None)
if tool is None:
logger = context.getLogger('actions')
logger.info('Nothing to export.')
Modified: CMF/trunk/CMFCore/exportimport/catalog.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/catalog.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/catalog.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -15,26 +15,25 @@
$Id$
"""
-from Products.CMFCore.interfaces import ICatalogTool
from Products.GenericSetup.utils import exportObjects
from Products.GenericSetup.utils import importObjects
-from zope.component import getSiteManager
+from Products.CMFCore.utils import getToolByName
def importCatalogTool(context):
"""Import catalog tool.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.getUtility(ICatalogTool)
+ site = context.getSite()
+ tool = getToolByName(site, 'portal_catalog')
importObjects(tool, '', context)
def exportCatalogTool(context):
"""Export catalog tool.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.queryUtility(ICatalogTool)
+ site = context.getSite()
+ tool = getToolByName(site, 'portal_catalog', None)
if tool is None:
logger = context.getLogger('catalog')
logger.info('Nothing to export.')
Modified: CMF/trunk/CMFCore/exportimport/content.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/content.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/content.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -20,13 +20,13 @@
from ConfigParser import ConfigParser
from StringIO import StringIO
-from zope.component import getUtility
from zope.interface import implements
from Products.GenericSetup.interfaces import IFilesystemExporter
from Products.GenericSetup.interfaces import IFilesystemImporter
from Products.GenericSetup.content import _globtest
-from Products.CMFCore.interfaces import ITypesTool
+from Products.CMFCore.utils import getToolByName
+
#
# setup_tool handlers
#
@@ -179,7 +179,7 @@
context = self.context
properties = import_context.readDataFile('.properties',
'%s/%s' % (subdir, id))
- tool = getUtility(ITypesTool)
+ tool = getToolByName(context, 'portal_types')
try:
tool.constructContent(portal_type, context, id)
Modified: CMF/trunk/CMFCore/exportimport/contenttyperegistry.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/contenttyperegistry.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/contenttyperegistry.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -16,15 +16,16 @@
"""
from zope.component import adapts
-from zope.component import getSiteManager
-from Products.CMFCore.interfaces import IContentTypeRegistry
from Products.GenericSetup.interfaces import ISetupEnviron
from Products.GenericSetup.utils import exportObjects
from Products.GenericSetup.utils import importObjects
from Products.GenericSetup.utils import XMLAdapterBase
+from Products.CMFCore.interfaces import IContentTypeRegistry
+from Products.CMFCore.utils import getToolByName
+
class ContentTypeRegistryXMLAdapter(XMLAdapterBase):
"""XML im- and exporter for ContentTypeRegistry.
@@ -110,16 +111,16 @@
def importContentTypeRegistry(context):
"""Import content type registry settings from an XML file.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.getUtility(IContentTypeRegistry)
+ site = context.getSite()
+ tool = getToolByName(site, 'content_type_registry')
importObjects(tool, '', context)
def exportContentTypeRegistry(context):
"""Export content type registry settings as an XML file.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.queryUtility(IContentTypeRegistry)
+ site = context.getSite()
+ tool = getToolByName(site, 'content_type_registry', None)
if tool is None:
logger = context.getLogger('contenttypes')
logger.info('Nothing to export.')
Modified: CMF/trunk/CMFCore/exportimport/cookieauth.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/cookieauth.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/cookieauth.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -16,8 +16,6 @@
"""
from zope.component import adapts
-from zope.component import getSiteManager
-from zope.component import queryUtility
from Products.GenericSetup.interfaces import ISetupEnviron
from Products.GenericSetup.utils import exportObjects
@@ -26,6 +24,7 @@
from Products.GenericSetup.utils import XMLAdapterBase
from Products.CMFCore.interfaces import ICookieCrumbler
+from Products.CMFCore.utils import getToolByName
class CookieCrumblerXMLAdapter(XMLAdapterBase, PropertyManagerHelpers):
@@ -62,16 +61,16 @@
def importCookieCrumbler(context):
"""Import cookie crumbler settings from an XML file.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.getUtility(ICookieCrumbler)
+ site = context.getSite()
+ tool = getToolByName(site, 'cookie_authentication')
importObjects(tool, '', context)
def exportCookieCrumbler(context):
"""Export cookie crumbler settings as an XML file.
"""
- sm = getSiteManager(context.getSite())
- tool = queryUtility(ICookieCrumbler)
+ site = context.getSite()
+ tool = getToolByName(site, 'cookie_authentication', None)
if tool is None:
logger = context.getLogger('cookies')
logger.info('Nothing to export.')
Modified: CMF/trunk/CMFCore/exportimport/skins.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/skins.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/skins.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -17,9 +17,7 @@
from Acquisition import aq_inner
from Acquisition import aq_parent
-
from zope.component import adapts
-from zope.component import getSiteManager
from Products.GenericSetup.interfaces import ISetupEnviron
from Products.GenericSetup.utils import exportObjects
@@ -30,6 +28,7 @@
from Products.CMFCore.interfaces import IDirectoryView
from Products.CMFCore.interfaces import ISkinsTool
+from Products.CMFCore.utils import getToolByName
class DirectoryViewNodeAdapter(NodeAdapterBase):
@@ -219,16 +218,16 @@
def importSkinsTool(context):
"""Import skins tool FSDirViews and skin paths from an XML file.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.getUtility(ISkinsTool)
+ site = context.getSite()
+ tool = getToolByName(site, 'portal_skins')
importObjects(tool, '', context)
def exportSkinsTool(context):
"""Export skins tool FSDVs and skin paths as an XML file.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.queryUtility(ISkinsTool)
+ site = context.getSite()
+ tool = getToolByName(site, 'portal_skins', None)
if tool is None:
logger = context.getLogger('skins')
logger.info('Nothing to export.')
Modified: CMF/trunk/CMFCore/exportimport/tests/test_actions.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_actions.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/tests/test_actions.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -21,7 +21,6 @@
from Acquisition import aq_parent
from Acquisition import Implicit
from OFS.OrderedFolder import OrderedFolder
-from zope.component import getSiteManager
from zope.interface import implements
from zope.interface import Interface
@@ -30,7 +29,6 @@
from Products.CMFCore.interfaces import IActionsTool
from Products.CMFCore.testing import ExportImportZCMLLayer
from Products.CMFCore.tests.base.dummy import DummySite
-from Products.CMFCore.utils import registerToolInterface
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.testing import NodeAdapterTestCase
from Products.GenericSetup.tests.common import BaseRegistryTests
@@ -199,15 +197,7 @@
</object>
"""
-class IFoo(Interface):
- """ Foo interface """
-registerToolInterface('portal_foo', IFoo)
-class IBar(Interface):
- """ Bar interface """
-registerToolInterface('portal_bar', IBar)
-
-
class DummyTool(OrderedFolder, ActionProviderBase):
implements(IActionProvider)
@@ -338,7 +328,6 @@
self.assertEqual(obj.action_providers[0], 'portal_actions')
def setUp(self):
- from Products.CMFCore.interfaces import IActionsTool
from Products.CMFCore.ActionsTool import ActionsTool
BodyAdapterTestCase.setUp(self)
@@ -347,16 +336,10 @@
self._obj = site.portal_actions
self._BODY = _ACTIONSTOOL_BODY
- # utility registration
- sm = getSiteManager()
- sm.registerUtility(self._obj, IActionsTool)
-
class _ActionSetup(BaseRegistryTests):
def _initSite(self, foo=2, bar=2):
- from zope.component import getSiteManager
-
self.root.site = DummySite('site')
site = self.root.site
site.portal_membership = DummyMembershipTool()
@@ -364,12 +347,8 @@
site.portal_actions = DummyActionsTool()
site.portal_actions.addActionProvider('portal_actions')
- sm = getSiteManager(site)
- sm.registerUtility(site.portal_actions, IActionsTool)
-
if foo > 0:
site.portal_foo = DummyTool()
- sm.registerUtility(site.portal_foo, IFoo)
if foo > 1:
site.portal_foo.addAction(id='foo',
@@ -383,7 +362,6 @@
if bar > 0:
site.portal_bar = DummyTool()
- sm.registerUtility(site.portal_bar, IBar)
if bar > 1:
site.portal_bar.addAction(id='bar',
Modified: CMF/trunk/CMFCore/exportimport/tests/test_catalog.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_catalog.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/tests/test_catalog.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -25,14 +25,11 @@
from Products.ZCTextIndex.Lexicon import StopWordRemover
from Products.ZCTextIndex.ZCTextIndex import PLexicon
-from zope.component import getSiteManager
-
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
from Products.CMFCore.CatalogTool import CatalogTool
-from Products.CMFCore.interfaces import ICatalogTool
from Products.CMFCore.testing import ExportImportZCMLLayer
_EMPTY_EXPORT = """\
@@ -82,9 +79,6 @@
site = self.root.site = Folder(id='site')
ctool = site.portal_catalog = CatalogTool()
- sm = getSiteManager(site)
- sm.registerUtility(ctool, ICatalogTool)
-
for obj_id in ctool.objectIds():
ctool._delObject(obj_id)
for idx_id in ctool.indexes():
Modified: CMF/trunk/CMFCore/exportimport/tests/test_content.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_content.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/tests/test_content.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -22,10 +22,8 @@
from ConfigParser import ConfigParser
from StringIO import StringIO
-from zope.component import getSiteManager
from zope.testing.cleanup import cleanUp
-from Products.CMFCore.interfaces import ITypesTool
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
@@ -752,9 +750,7 @@
folder = PortalFolder(id)
folder.portal_type = TEST_FOLDER
if site_folder:
- sm = getSiteManager()
tool = folder.portal_types = TypesTool()
- sm.registerUtility(tool, ITypesTool)
tool._setObject(TEST_CSV_AWARE, _TypeInfo(TEST_CSV_AWARE))
tool._setObject(TEST_INI_AWARE, _TypeInfo(TEST_INI_AWARE))
tool._setObject(TEST_CONTENT, _TypeInfo(TEST_CONTENT))
Modified: CMF/trunk/CMFCore/exportimport/tests/test_contenttyperegistry.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_contenttyperegistry.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/tests/test_contenttyperegistry.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -20,9 +20,6 @@
from OFS.Folder import Folder
-from zope.component import getSiteManager
-
-from Products.CMFCore.interfaces import IContentTypeRegistry
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
@@ -158,9 +155,6 @@
ctr = ContentTypeRegistry()
site._setObject( ctr.getId(), ctr )
- sm = getSiteManager(site)
- sm.registerUtility(site.content_type_registry, IContentTypeRegistry)
-
if mit_predikat:
for (predicate_id, predicate_type, edit_args, content_type_name
) in _TEST_PREDICATES:
Modified: CMF/trunk/CMFCore/exportimport/tests/test_cookieauth.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_cookieauth.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/tests/test_cookieauth.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -20,15 +20,12 @@
from OFS.Folder import Folder
-from zope.component import getSiteManager
-
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
from Products.CMFCore.CookieCrumbler import CookieCrumbler
-from Products.CMFCore.interfaces import ICookieCrumbler
from Products.CMFCore.testing import ExportImportZCMLLayer
_COOKIECRUMBLER_BODY = """\
@@ -103,9 +100,6 @@
site = self.root.site
cc = site.cookie_authentication = CookieCrumbler('foo_cookiecrumbler')
- sm = getSiteManager()
- sm.registerUtility(site.cookie_authentication, ICookieCrumbler)
-
if use_changed:
cc.auth_cookie = 'value1'
cc.cache_header_value = 'value2'
Modified: CMF/trunk/CMFCore/exportimport/tests/test_skins.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_skins.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/tests/test_skins.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -22,8 +22,6 @@
import os
from OFS.Folder import Folder
-
-from zope.component import getSiteManager
from zope.interface import implements
from Products.GenericSetup.testing import BodyAdapterTestCase
@@ -299,9 +297,6 @@
id)) for id in ids ]
site._setObject('portal_skins', DummySkinsTool(selections, fsdvs))
- sm = getSiteManager(site)
- sm.registerUtility(site.portal_skins, ISkinsTool)
-
site.REQUEST = 'exists'
return site
Modified: CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -20,14 +20,11 @@
from OFS.Folder import Folder
-from zope.component import getSiteManager
-
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.permissions import View
from Products.CMFCore.permissions import AccessContentsInformation
from Products.CMFCore.permissions import ModifyPortalContent
@@ -322,9 +319,6 @@
site = self.root.site
ttool = site.portal_types = TypesTool()
- sm = getSiteManager()
- sm.registerUtility(ttool, ITypesTool)
-
if foo == 1:
fti = _TI_LIST[0].copy()
ttool._setObject(fti['id'], FactoryTypeInformation(**fti))
Modified: CMF/trunk/CMFCore/exportimport/tests/test_workflow.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_workflow.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/tests/test_workflow.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -19,8 +19,6 @@
import Testing
from OFS.Folder import Folder
-
-from zope.component import getSiteManager
from zope.interface import implements
from Products.GenericSetup.testing import BodyAdapterTestCase
@@ -165,10 +163,6 @@
self.root.site = Folder(id='site')
site = self.root.site
self.root.site.portal_workflow = DummyWorkflowTool()
- sm = getSiteManager()
- sm.registerUtility( self.root.site.portal_workflow
- , IConfigurableWorkflowTool
- )
return site
Modified: CMF/trunk/CMFCore/exportimport/typeinfo.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/typeinfo.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/typeinfo.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -16,7 +16,6 @@
"""
from zope.component import adapts
-from zope.component import getSiteManager
from Products.GenericSetup.interfaces import ISetupEnviron
from Products.GenericSetup.utils import exportObjects
@@ -28,6 +27,7 @@
from Products.CMFCore.interfaces import ITypeInformation
from Products.CMFCore.interfaces import ITypesTool
+from Products.CMFCore.utils import getToolByName
class TypeInformationXMLAdapter(XMLAdapterBase, PropertyManagerHelpers):
@@ -177,16 +177,16 @@
def importTypesTool(context):
"""Import types tool and content types from XML files.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.getUtility(ITypesTool)
+ site = context.getSite()
+ tool = getToolByName(site, 'portal_types')
importObjects(tool, '', context)
def exportTypesTool(context):
"""Export types tool content types as a set of XML files.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.queryUtility(ITypesTool)
+ site = context.getSite()
+ tool = getToolByName(site, 'portal_types', None)
if tool is None:
logger = context.getLogger('types')
logger.info('Nothing to export.')
Modified: CMF/trunk/CMFCore/exportimport/workflow.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/workflow.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/exportimport/workflow.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -16,7 +16,6 @@
"""
from zope.component import adapts
-from zope.component import getSiteManager
from Products.GenericSetup.interfaces import ISetupEnviron
from Products.GenericSetup.utils import exportObjects
@@ -26,6 +25,7 @@
from Products.GenericSetup.utils import XMLAdapterBase
from Products.CMFCore.interfaces import IConfigurableWorkflowTool
+from Products.CMFCore.utils import getToolByName
class WorkflowToolXMLAdapter(XMLAdapterBase, ObjectManagerHelpers,
@@ -120,16 +120,16 @@
def importWorkflowTool(context):
"""Import workflow tool and contained workflow definitions from XML files.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.getUtility(IConfigurableWorkflowTool)
+ site = context.getSite()
+ tool = getToolByName(site, 'portal_workflow')
importObjects(tool, '', context)
def exportWorkflowTool(context):
"""Export workflow tool and contained workflow definitions as XML files.
"""
- sm = getSiteManager(context.getSite())
- tool = sm.queryUtility(IConfigurableWorkflowTool)
+ site = context.getSite()
+ tool = getToolByName(site, 'portal_workflow', None)
if tool is None:
logger = context.getLogger('workflow')
logger.info('Nothing to export.')
Modified: CMF/trunk/CMFCore/tests/base/dummy.py
===================================================================
--- CMF/trunk/CMFCore/tests/base/dummy.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/base/dummy.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -263,6 +263,8 @@
def all_meta_types(self):
return ({'name': 'Dummy', 'permission': 'addFoo'},)
+ def getTypeInfo(self):
+ return self.portal_types.getTypeInfo(self) # Can return None.
class DummySite(DummyFolder):
""" A dummy portal folder.
Modified: CMF/trunk/CMFCore/tests/test_ActionsTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_ActionsTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_ActionsTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -28,7 +28,6 @@
from Products.CMFCore.Expression import Expression
from Products.CMFCore.interfaces import IMembershipTool
from Products.CMFCore.interfaces import ISiteRoot
-from Products.CMFCore.interfaces import IURLTool
from Products.CMFCore.MembershipTool import MembershipTool
from Products.CMFCore.tests.base.testcase import SecurityRequestTest
from Products.CMFCore.URLTool import URLTool
@@ -107,7 +106,6 @@
sm.registerUtility(root, ISiteRoot)
root._setObject( 'portal_actions', self._makeOne() )
root._setObject( 'portal_url', URLTool() )
- sm.registerUtility(root.portal_url, IURLTool)
root._setObject( 'foo', URLTool() )
root._setObject('portal_membership', MembershipTool())
sm.registerUtility(root.portal_membership, IMembershipTool)
Modified: CMF/trunk/CMFCore/tests/test_CMFCatalogAware.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_CMFCatalogAware.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_CMFCatalogAware.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -23,13 +23,10 @@
from OFS.Folder import Folder
from OFS.SimpleItem import SimpleItem
-from zope.component import getSiteManager
from zope.interface import implements
from Products.CMFCore.CMFCatalogAware import CMFCatalogAware
from Products.CMFCore.exceptions import NotFound
-from Products.CMFCore.interfaces import ICatalogTool
-from Products.CMFCore.interfaces import IConfigurableWorkflowTool
from Products.CMFCore.interfaces import IContentish
from Products.CMFCore.testing import EventZCMLLayer
from Products.CMFCore.testing import TraversingZCMLLayer
@@ -126,11 +123,8 @@
self.root = DummyRoot('')
self.root.site = SimpleFolder('site')
self.site = self.root.site
- sm = getSiteManager(self.site)
self.site._setObject('portal_catalog', DummyCatalog())
- sm.registerUtility(self.site.portal_catalog, ICatalogTool)
self.site._setObject('portal_workflow', DummyWorkflowTool())
- sm.registerUtility(self.site.portal_workflow, IConfigurableWorkflowTool)
self.site.foo = TheClass('foo')
def tearDown(self):
@@ -229,10 +223,8 @@
def _makeSite(self):
self.app._setObject('site', SimpleFolder('site'))
- sm = getSiteManager(self.app.site)
site = self.app._getOb('site')
site._setObject('portal_catalog', DummyCatalog())
- sm.registerUtility(site.portal_catalog, ICatalogTool)
site._setObject('portal_workflow', DummyWorkflowTool())
# Hack, we need a _p_mtime for the file, so we make sure that it
# has one. We use a subtransaction, which means we can rollback
Modified: CMF/trunk/CMFCore/tests/test_CachingPolicyManager.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_CachingPolicyManager.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_CachingPolicyManager.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -33,7 +33,6 @@
from Products.CMFCore.FSDTMLMethod import FSDTMLMethod
from Products.CMFCore.FSPageTemplate import FSPageTemplate
from Products.CMFCore.interfaces import ICachingPolicyManager
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.testing import FunctionalZCMLLayer
from Products.CMFCore.testing import TraversingZCMLLayer
from Products.CMFCore.tests.base.dummy import DummyContent
@@ -644,10 +643,8 @@
now = DateTime()
# Create a fake portal and the tools we need
- sm = getSiteManager()
self.portal = DummySite(id='portal').__of__(self.root)
self.portal._setObject('portal_types', DummyTool())
- sm.registerUtility(self.portal.portal_types, ITypesTool)
# This is a FSPageTemplate that will be used as the View for
# our content objects. It doesn't matter what it returns.
Modified: CMF/trunk/CMFCore/tests/test_DynamicType.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_DynamicType.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_DynamicType.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -36,7 +36,6 @@
from Products.CMFCore.DynamicType import DynamicType
from Products.CMFCore.interfaces import IMembershipTool
from Products.CMFCore.interfaces import ISiteRoot
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.tests.base.dummy import DummyObject
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
@@ -75,7 +74,6 @@
sm = getSiteManager()
self.site = DummySite('site')
self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(self.site.portal_types, ITypesTool)
fti = FTIDATA_CMF15[0].copy()
self.site.portal_types._setObject( 'Dummy Content 15', FTI(**fti) )
self.site._setObject( 'foo', DummyContent() )
@@ -161,7 +159,6 @@
self.site._setObject( 'portal_membership', DummyTool() )
sm.registerUtility(self.site.portal_membership, IMembershipTool)
self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(self.site.portal_types, ITypesTool)
fti = FTIDATA_CMF15[0].copy()
self.site.portal_types._setObject( 'Dummy Content 15', FTI(**fti) )
self.site._setObject( 'foo', DummyContent() )
Modified: CMF/trunk/CMFCore/tests/test_FSDTMLMethod.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSDTMLMethod.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_FSDTMLMethod.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -24,11 +24,12 @@
from DateTime import DateTime
from OFS.Folder import Folder
from Products.StandardCacheManagers import RAMCacheManager
+from zope.app.component.hooks import setHooks
+from zope.component import getSiteManager
from Products.CMFCore.FSDTMLMethod import FSDTMLMethod
from Products.CMFCore.FSMetadata import FSMetadata
from Products.CMFCore.interfaces import ICachingPolicyManager
-from Products.CMFCore.interfaces import ISkinsTool
from Products.CMFCore.tests.base.dummy import DummyCachingManager
from Products.CMFCore.tests.base.dummy import DummyCachingManagerWithPolicy
from Products.CMFCore.tests.base.testcase import FSDVTest
@@ -36,10 +37,7 @@
from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.tests.base.dummy import DummyContent
-from zope.app.component.hooks import setHooks
-from zope.component import getSiteManager
-
class FSDTMLMaker(FSDVTest):
def _makeOne( self, id, filename ):
@@ -122,8 +120,6 @@
self.root._setObject( 'portal_skins', Folder( 'portal_skins' ) )
self.skins = self.root.portal_skins
- sm = getSiteManager()
- sm.registerUtility(self.skins, ISkinsTool)
self.skins._setObject( 'custom', Folder( 'custom' ) )
self.custom = self.skins.custom
Modified: CMF/trunk/CMFCore/tests/test_FSPageTemplate.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSPageTemplate.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_FSPageTemplate.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -33,7 +33,6 @@
from Products.CMFCore.FSPageTemplate import FSPageTemplate
from Products.CMFCore.FSMetadata import FSMetadata
from Products.CMFCore.interfaces import ICachingPolicyManager
-from Products.CMFCore.interfaces import ISkinsTool
from Products.CMFCore.testing import TraversingZCMLLayer
from Products.CMFCore.tests.base.dummy import DummyCachingManager
from Products.CMFCore.tests.base.testcase import FSDVTest
@@ -168,8 +167,6 @@
self.root._setObject( 'portal_skins', Folder( 'portal_skins' ) )
self.skins = self.root.portal_skins
- sm = getSiteManager()
- sm.registerUtility(self.skins, ISkinsTool)
self.skins._setObject( 'custom', Folder( 'custom' ) )
self.custom = self.skins.custom
Modified: CMF/trunk/CMFCore/tests/test_FSPropertiesObject.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSPropertiesObject.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_FSPropertiesObject.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,12 +1,11 @@
import unittest
from Acquisition import aq_base
-from zope.component import getSiteManager
-from Products.CMFCore.interfaces import ISkinsTool
from Products.CMFCore.tests.base.testcase import FSDVTest
from Products.CMFCore.tests.base.testcase import SecurityTest
+
class FSPOTests(SecurityTest, FSDVTest):
def setUp( self ):
@@ -31,8 +30,6 @@
self.root._setObject( 'portal_skins', Folder( 'portal_skins' ) )
skins = self.root.portal_skins
- sm = getSiteManager()
- sm.registerUtility(skins, ISkinsTool)
skins._setObject( 'custom', Folder( 'custom' ) )
custom = skins.custom
Modified: CMF/trunk/CMFCore/tests/test_FSPythonScript.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSPythonScript.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_FSPythonScript.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -29,11 +29,8 @@
from OFS.SimpleItem import SimpleItem
from Products.StandardCacheManagers import RAMCacheManager
-from zope.component import getSiteManager
-
from Products.CMFCore.FSMetadata import FSMetadata
from Products.CMFCore.FSPythonScript import FSPythonScript
-from Products.CMFCore.interfaces import ISkinsTool
from Products.CMFCore.tests.base.testcase import FSDVTest
from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.tests.base.testcase import WarningInterceptor
@@ -101,8 +98,6 @@
root = self.root
root._setObject( 'portal_skins', Folder( 'portal_skins' ) )
tool = self.root.portal_skins
- sm = getSiteManager()
- sm.registerUtility(tool, ISkinsTool)
tool._setObject( 'custom', Folder( 'custom' ) )
custom = tool.custom
Modified: CMF/trunk/CMFCore/tests/test_FSReSTMethod.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSReSTMethod.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_FSReSTMethod.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -25,7 +25,6 @@
from zope.testing.cleanup import cleanUp
from Products.CMFCore.interfaces import ICachingPolicyManager
-from Products.CMFCore.interfaces import ISkinsTool
from Products.CMFCore.testing import TraversingZCMLLayer
from Products.CMFCore.tests.base.testcase import FSDVTest
from Products.CMFCore.tests.base.testcase import RequestTest
@@ -173,8 +172,6 @@
self.root._setObject( 'portal_skins', Folder( 'portal_skins' ) )
self.skins = self.root.portal_skins
- sm = getSiteManager()
- sm.registerUtility(self.skins, ISkinsTool)
self.skins._setObject( 'custom', Folder( 'custom' ) )
self.custom = self.skins.custom
Modified: CMF/trunk/CMFCore/tests/test_FSSTXMethod.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSSTXMethod.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_FSSTXMethod.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -25,7 +25,6 @@
from zope.testing.cleanup import cleanUp
from Products.CMFCore.interfaces import ICachingPolicyManager
-from Products.CMFCore.interfaces import ISkinsTool
from Products.CMFCore.testing import TraversingZCMLLayer
from Products.CMFCore.tests.base.testcase import FSDVTest
from Products.CMFCore.tests.base.testcase import RequestTest
@@ -207,8 +206,6 @@
self.root._setObject( 'portal_skins', Folder( 'portal_skins' ) )
self.skins = self.root.portal_skins
- sm = getSiteManager()
- sm.registerUtility(self.skins, ISkinsTool)
self.skins._setObject( 'custom', Folder( 'custom' ) )
self.custom = self.skins.custom
Modified: CMF/trunk/CMFCore/tests/test_FSZSQLMethod.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSZSQLMethod.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_FSZSQLMethod.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -7,11 +7,8 @@
from Acquisition import aq_base
from OFS.Folder import Folder
-from zope.component import getSiteManager
-
from Products.CMFCore.FSMetadata import FSMetadata
from Products.CMFCore.FSZSQLMethod import FSZSQLMethod
-from Products.CMFCore.interfaces import ISkinsTool
from Products.CMFCore.tests.base.testcase import FSDVTest
from Products.CMFCore.tests.base.testcase import SecurityTest
@@ -53,8 +50,6 @@
self.root._setObject( 'portal_skins', Folder( 'portal_skins' ) )
self.skins = self.root.portal_skins
- sm = getSiteManager()
- sm.registerUtility(self.skins, ISkinsTool)
self.skins._setObject( 'custom', Folder( 'custom' ) )
self.custom = self.skins.custom
Modified: CMF/trunk/CMFCore/tests/test_OpaqueItems.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_OpaqueItems.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_OpaqueItems.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -18,13 +18,11 @@
import unittest
import Testing
-from zope.component import getSiteManager
from zope.interface import implements
from Products.CMFCore.interfaces import ICallableOpaqueItem
from Products.CMFCore.interfaces import ICallableOpaqueItemEvents
from Products.CMFCore.interfaces import IContentish
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.PortalFolder import PortalFolder
from Products.CMFCore.testing import TraversingEventZCMLLayer
from Products.CMFCore.tests.base.dummy \
@@ -142,11 +140,9 @@
SecurityTest.setUp(self)
root = self.root
- sm = getSiteManager()
# setting up types tool
root._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(root.portal_types, ITypesTool)
# setup portal
try:
Modified: CMF/trunk/CMFCore/tests/test_PortalContent.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_PortalContent.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_PortalContent.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -21,12 +21,10 @@
from AccessControl.SecurityManagement import newSecurityManager
from Acquisition import aq_base
from OFS.Folder import Folder
-from zope.component import getSiteManager
from zope.interface.verify import verifyClass
from zope.testing.cleanup import cleanUp
from Products.CMFCore.exceptions import NotFound
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.testing import TraversingEventZCMLLayer
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFCore.tests.base.dummy import DummyObject
@@ -50,14 +48,11 @@
verifyClass(IDynamicType, PortalContent)
def _setupCallTests(self, aliases):
- sm = getSiteManager()
-
# root
root = Folder( 'root' )
# set up dummy type info with problematic double-default alias
root._setObject( 'portal_types', DummyTool() )
- sm.registerUtility(root.portal_types, ITypesTool)
root.portal_types._type_actions = aliases
# dummy content and skin
Modified: CMF/trunk/CMFCore/tests/test_PortalFolder.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_PortalFolder.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_PortalFolder.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -33,7 +33,6 @@
from Products.CMFCore.CatalogTool import CatalogTool
from Products.CMFCore.exceptions import BadRequest
-from Products.CMFCore.interfaces import ICatalogTool
from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.testing import ConformsToFolder
from Products.CMFCore.testing import FunctionalZCMLLayer
@@ -78,7 +77,6 @@
newSecurityManager(None, acl_users.all_powerful_Oz)
ttool = self.site._setObject('portal_types', TypesTool())
- sm.registerUtility(self.site.portal_types, ITypesTool)
ttool._setObject(self._PORTAL_TYPE,
FTI(id=self._PORTAL_TYPE,
title='Folder or Directory',
@@ -139,9 +137,7 @@
verifyClass(IOrderedContainer, self._getTargetClass())
def test_contents_methods(self):
- sm = getSiteManager(self.site)
ttool = self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(ttool, ITypesTool)
f = self._makeOne('foo')
self.assertEqual( f.objectValues(), [] )
self.assertEqual( f.contentIds(), [] )
@@ -213,12 +209,9 @@
# Test is a new object does get cataloged upon _setObject
# and uncataloged upon manage_deleteObjects
#
- sm = getSiteManager(self.site)
test = self._makeOne('test')
ttool = self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(ttool, ITypesTool)
ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
- sm.registerUtility(ctool, ICatalogTool)
self.assertEqual( len(ctool), 0 )
test._setObject( 'foo', DummyContent( 'foo' , catalog=1 ) )
@@ -238,11 +231,8 @@
# Test to ensure a portal folder itself is *not* cataloged upon
# instantiation (Tracker issue 309)
#
- sm = getSiteManager(self.site)
ttool = self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(ttool, ITypesTool)
ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
- sm.registerUtility(ctool, ICatalogTool)
wftool = self.site._setObject( 'portal_workflow', WorkflowTool() )
test = self._makeOne('test')
wftool.notifyCreated(test)
@@ -256,12 +246,9 @@
#
from Products.CMFCore.PortalFolder import PortalFolder
- sm = getSiteManager(self.site)
test = self._makeOne('test')
ttool = self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(ttool, ITypesTool)
ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
- sm.registerUtility(ctool, ICatalogTool)
self.assertEqual( len(ctool), 0 )
test._setObject( 'sub', PortalFolder( 'sub', '' ) )
@@ -286,11 +273,9 @@
#
from Products.CMFCore.PortalFolder import PortalFolder
- sm = getSiteManager(self.site)
test = self._makeOne('test')
ttool = self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(ttool, ITypesTool)
ttool._setObject( 'Folder'
, FTI( id='Folder'
, title='Folder or Directory'
@@ -341,9 +326,7 @@
#
# _verifyObjectPaste() should honor allowed content types
#
- sm = getSiteManager(self.site)
ttool = self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(ttool, ITypesTool)
fti = FTIDATA_DUMMY[0].copy()
ttool._setObject( 'Dummy Content', FTI(**fti) )
ttool._setObject( 'Folder', FTI(**fti) )
@@ -391,11 +374,9 @@
self.assertRaises(BadRequest, test._checkId, 'acl_users')
def test__checkId_MethodAlias(self):
- sm = getSiteManager(self.site)
test = self._makeOne('test')
test._setPortalTypeName('Dummy Content 15')
ttool = self.site._setObject('portal_types', TypesTool())
- sm.registerUtility(self.site.portal_types, ITypesTool)
ttool._setObject('Dummy Content 15', FTI(**FTIDATA_CMF15[0]))
acl_users = self.site._setObject('acl_users', DummyUserFolder())
test._checkId('view.html')
@@ -454,11 +435,8 @@
#
from Products.CMFCore.PortalFolder import PortalFolder
- sm = getSiteManager(self.site)
ttool = self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(ttool, ITypesTool)
ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
- sm.registerUtility(ctool, ICatalogTool)
ctool.addIndex('getId', 'FieldIndex')
self.assertEqual( len(ctool), 0 )
@@ -503,11 +481,8 @@
#
# Does copy / paste work?
#
- sm = getSiteManager(self.site)
ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
- sm.registerUtility(ctool, ICatalogTool)
ttool = self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(ttool, ITypesTool)
fti = FTIDATA_DUMMY[0].copy()
ttool._setObject( 'Dummy Content', FTI(**fti) )
sub1 = self._makeOne('sub1')
@@ -1073,7 +1048,6 @@
from AccessControl.Permissions import delete_objects as DeleteObjects
from Products.CMFCore.PortalFolder import PortalFolder
- sm = getSiteManager()
folder1, folder2 = self._initFolders()
folder1.manage_permission( DeleteObjects, roles=(), acquire=0 )
@@ -1081,7 +1055,6 @@
transaction.savepoint(optimistic=True) # get a _p_jar for 'sub'
self.app.portal_types = DummyTypesTool()
- sm.registerUtility(self.app.portal_types, ITypesTool)
def _no_delete_objects(permission, object, context):
return permission != DeleteObjects
@@ -1108,13 +1081,11 @@
folder1, folder2 = self._initFolders()
folder1.portal_type = UNRESTRICTED_TYPE
folder2.portal_type = RESTRICTED_TYPE
- sm = getSiteManager()
self._initPolicyAndUser() # ensure that sec. machinery allows paste
self.app._setObject( 'portal_types', TypesTool() )
types_tool = self.app.portal_types
- sm.registerUtility(types_tool, ITypesTool)
types_tool._setObject( RESTRICTED_TYPE
, FTI( id=RESTRICTED_TYPE
, title=RESTRICTED_TYPE
@@ -1155,13 +1126,11 @@
folder1, folder2 = self._initFolders()
folder1.portal_type = UNRESTRICTED_TYPE
folder2.portal_type = RESTRICTED_TYPE
- sm = getSiteManager()
self._initPolicyAndUser() # ensure that sec. machinery allows paste
self.app._setObject( 'portal_types', TypesTool() )
types_tool = self.app.portal_types
- sm.registerUtility(types_tool, ITypesTool)
types_tool._setObject( RESTRICTED_TYPE
, FTI( id=RESTRICTED_TYPE
, title=RESTRICTED_TYPE
@@ -1201,13 +1170,11 @@
folder1, folder2 = self._initFolders()
folder1.portal_type = RESTRICTED_TYPE
folder2.portal_type = UNRESTRICTED_TYPE
- sm = getSiteManager()
self._initPolicyAndUser() # ensure that sec. machinery allows paste
self.app._setObject( 'portal_types', TypesTool() )
types_tool = self.app.portal_types
- sm.registerUtility(types_tool, ITypesTool)
types_tool._setObject( RESTRICTED_TYPE
, FTI( id=RESTRICTED_TYPE
, title=RESTRICTED_TYPE
Modified: CMF/trunk/CMFCore/tests/test_SkinsTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_SkinsTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_SkinsTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -22,9 +22,7 @@
from zope.interface.verify import verifyClass
from zope.testing.cleanup import cleanUp
-from Products.CMFCore.interfaces import ISkinsTool
-
class SkinsContainerTests(unittest.TestCase):
def test_interfaces(self):
@@ -44,6 +42,7 @@
def test_interfaces(self):
from Products.CMFCore.interfaces import IActionProvider
from Products.CMFCore.interfaces import ISkinsContainer
+ from Products.CMFCore.interfaces import ISkinsTool
from Products.CMFCore.SkinsTool import SkinsTool
verifyClass(IActionProvider, SkinsTool)
@@ -78,11 +77,12 @@
class TestSkinnableObjectManager(SkinnableObjectManager):
tool = SkinsTool()
- sm = getSiteManager()
- sm.registerUtility(tool, ISkinsTool)
# This is needed otherwise REQUEST is the string
# '<Special Object Used to Force Acquisition>'
REQUEST = None
+ def getSkinsFolderName(self):
+ '''tool'''
+ return 'tool'
return TestSkinnableObjectManager()
Modified: CMF/trunk/CMFCore/tests/test_WorkflowTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_WorkflowTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFCore/tests/test_WorkflowTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -20,7 +20,6 @@
from OFS.SimpleItem import SimpleItem
from zope.component import adapter
-from zope.component import getSiteManager
from zope.component import provideHandler
from zope.interface import implements
from zope.interface.verify import verifyClass
@@ -30,7 +29,6 @@
from Products.CMFCore.interfaces import IActionSucceededEvent
from Products.CMFCore.interfaces import IActionWillBeInvokedEvent
from Products.CMFCore.interfaces import IContentish
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.interfaces import IWorkflowDefinition
@@ -171,11 +169,9 @@
def _makeRoot( self ):
from OFS.Folder import Folder
- sm = getSiteManager()
root = Folder( 'root' )
tt = DummyTypesTool()
root._setObject( 'portal_types', tt )
- sm.registerUtility(root.portal_types, ITypesTool)
return root
def _makeWithTypes( self ):
Modified: CMF/trunk/CMFDefault/DefaultWorkflow.py
===================================================================
--- CMF/trunk/CMFDefault/DefaultWorkflow.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/DefaultWorkflow.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -22,14 +22,13 @@
from DateTime import DateTime
from Globals import InitializeClass
from zope.component import getUtility
-from zope.component import queryUtility
from zope.interface import implements
-from Products.CMFCore.interfaces import ICatalogTool
from Products.CMFCore.interfaces import IMembershipTool
from Products.CMFCore.interfaces import IWorkflowDefinition
from Products.CMFCore.utils import _checkPermission
from Products.CMFCore.utils import _modifyPermissionMappings
+from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import SimpleItemWithProperties
from exceptions import AccessControl_Unauthorized
@@ -155,7 +154,7 @@
return None
actions = []
- catalog = queryUtility(ICatalogTool)
+ catalog = getToolByName(self, 'portal_catalog', None)
if catalog is None:
return actions
Modified: CMF/trunk/CMFDefault/DiscussionTool.py
===================================================================
--- CMF/trunk/CMFDefault/DiscussionTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/DiscussionTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -27,7 +27,6 @@
from Products.CMFCore.interfaces import IDiscussionResponse
from Products.CMFCore.interfaces import IDiscussionTool
from Products.CMFCore.interfaces import IMembershipTool
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.utils import registerToolInterface
from Products.CMFCore.utils import UniqueObject
@@ -103,7 +102,7 @@
"""
if hasattr( aq_base(content), 'allow_discussion' ):
return bool(content.allow_discussion)
- typeInfo = getUtility(ITypesTool).getTypeInfo( content )
+ typeInfo = content.getTypeInfo()
if typeInfo:
return bool( typeInfo.allowDiscussion() )
return False
Modified: CMF/trunk/CMFDefault/Extensions/update_catalogIndexes.py
===================================================================
--- CMF/trunk/CMFDefault/Extensions/update_catalogIndexes.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/Extensions/update_catalogIndexes.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,5 +1,4 @@
-from zope.component import queryUtility
-from Products.CMFCore.interfaces import ICatalogTool
+from Products.CMFCore.utils import getToolByName
def update_catalogIndexes(self, REQUEST):
'''
@@ -9,7 +8,7 @@
rIndexes = {'allowedRolesAndUsers': 'KeywordIndex'
, 'effective': 'FieldIndex'
, 'expires': 'FieldIndex'}
- ct = queryUtility(ICatalogTool)
+ ct = getToolByName(self, 'portal_catalog')
map(lambda x, ct=ct: ct.delIndex(x), rIndexes.keys())
map(lambda x, ct=ct: ct.addIndex(x[0], x[1]), rIndexes.items())
ct.manage_reindexIndex(ids=rIndexes.keys(), REQUEST=REQUEST)
Modified: CMF/trunk/CMFDefault/Favorite.py
===================================================================
--- CMF/trunk/CMFDefault/Favorite.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/Favorite.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -28,11 +28,7 @@
from zope.interface import implements
from Products.CMFCore.interfaces import ISiteRoot
-from Products.CMFCore.interfaces import IURLTool
-try:
- from Products.CMFUid.interfaces import IUniqueIdHandler
-except ImportError:
- IUniqueIdHandler = None
+from Products.CMFCore.utils import getToolByName
from DublinCore import DefaultDublinCoreImpl
from interfaces import IFavorite
@@ -74,7 +70,7 @@
the unique id handler tool is available.
"""
# check for unique id handler tool
- handler = IUniqueIdHandler and queryUtility(IUniqueIdHandler)
+ handler = getToolByName(self, 'portal_uidhandler', None)
if handler is None:
return
@@ -86,7 +82,7 @@
the unique id handler tool is available.
"""
# check for unique id handler tool
- handler = IUniqueIdHandler and queryUtility(IUniqueIdHandler)
+ handler = getToolByName(self, 'portal_uidhandler', None)
if handler is None:
return
@@ -117,7 +113,7 @@
def _getRemoteUrlTheOldWay(self):
"""Build the url without having taking the uid into account
"""
- portal_url = getUtility(IURLTool)
+ portal_url = getToolByName(self, 'portal_url')
if self.remote_url:
return portal_url() + '/' + self.remote_url
else:
@@ -159,7 +155,7 @@
t=('', '') + tokens[2:]
remote_url=urlparse.urlunparse(t)
# if URL begins with site URL, remove site URL
- portal_url = getUtility(IURLTool).getPortalPath()
+ portal_url = getToolByName(self, 'portal_url').getPortalPath()
i = remote_url.find(portal_url)
if i==0:
remote_url=remote_url[len(portal_url):]
Modified: CMF/trunk/CMFDefault/browser/favorite.py
===================================================================
--- CMF/trunk/CMFDefault/browser/favorite.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/browser/favorite.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -19,14 +19,13 @@
from zope.app.form.browser import BytesWidget
from zope.component import adapts
-from zope.component import getUtility
from zope.formlib import form
from zope.interface import implements
from zope.interface import Interface
from zope.schema import BytesLine
from zope.schema import TextLine
-from Products.CMFCore.interfaces import IURLTool
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.formlib.form import ContentEditFormBase
from Products.CMFDefault.formlib.schema import ProxyFieldProperty
from Products.CMFDefault.formlib.schema import SchemaAdapterBase
@@ -83,7 +82,7 @@
value = urlparse.urlunparse(tokens)
# if URL begins with site URL, remove site URL
obj = self.context.context.context
- portal_url = getUtility(IURLTool)
+ portal_url = getToolByName(obj, 'portal_url').getPortalPath()
if value.startswith(portal_url):
value = value[len(portal_url):]
# if site is still absolute, make it relative
Modified: CMF/trunk/CMFDefault/browser/folder.py
===================================================================
--- CMF/trunk/CMFDefault/browser/folder.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/browser/folder.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -24,7 +24,6 @@
from Products.CMFCore.interfaces import IDynamicType
from Products.CMFCore.interfaces import IMembershipTool
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFDefault.exceptions import CopyError
from Products.CMFDefault.exceptions import zExceptions_Unauthorized
from Products.CMFDefault.permissions import AddPortalContent
@@ -48,8 +47,8 @@
# helpers
- def _setRedirect(self, provider_iface, action_path, keys=''):
- provider = getUtility(provider_iface)
+ def _setRedirect(self, provider_id, action_path, keys=''):
+ provider = self._getTool(provider_id)
try:
target = provider.getActionInfo(action_path, self.context)['url']
except ValueError:
@@ -271,73 +270,73 @@
'title': _(u'New...'),
'permissions': (ViewManagementScreens, AddPortalContent),
'conditions': ('checkAllowedContentTypes',),
- 'redirect': (ITypesTool, 'object/new')},
+ 'redirect': ('portal_types', 'object/new')},
{'id': 'items_rename',
'title': _(u'Rename...'),
'permissions': (ViewManagementScreens, AddPortalContent),
'conditions': ('checkItems', 'checkAllowedContentTypes'),
'transform': ('validateItemIds',),
- 'redirect': (ITypesTool, 'object/rename_items',
+ 'redirect': ('portal_types', 'object/rename_items',
'b_start, ids, key, reverse')},
{'id': 'items_cut',
'title': _(u'Cut'),
'permissions': (ViewManagementScreens,),
'conditions': ('checkItems',),
'transform': ('validateItemIds', 'cut_control'),
- 'redirect': (ITypesTool, 'object/folderContents',
+ 'redirect': ('portal_types', 'object/folderContents',
'b_start, key, reverse')},
{'id': 'items_copy',
'title': _(u'Copy'),
'permissions': (ViewManagementScreens,),
'conditions': ('checkItems',),
'transform': ('validateItemIds', 'copy_control'),
- 'redirect': (ITypesTool, 'object/folderContents',
+ 'redirect': ('portal_types', 'object/folderContents',
'b_start, key, reverse')},
{'id': 'items_paste',
'title': _(u'Paste'),
'permissions': (ViewManagementScreens, AddPortalContent),
'conditions': ('checkClipboardData',),
'transform': ('validateClipboardData', 'paste_control'),
- 'redirect': (ITypesTool, 'object/folderContents',
+ 'redirect': ('portal_types', 'object/folderContents',
'b_start, key, reverse')},
{'id': 'items_delete',
'title': _(u'Delete'),
'permissions': (ViewManagementScreens, DeleteObjects),
'conditions': ('checkItems',),
'transform': ('validateItemIds', 'delete_control'),
- 'redirect': (ITypesTool, 'object/folderContents',
+ 'redirect': ('portal_types', 'object/folderContents',
'b_start, key, reverse')},
{'id': 'items_sort',
'permissions': (ManageProperties,),
'transform': ('sort_control',),
- 'redirect': (ITypesTool, 'object/folderContents',
+ 'redirect': ('portal_types', 'object/folderContents',
'b_start')},
{'id': 'items_up',
'permissions': (ManageProperties,),
'transform': ('validateItemIds', 'up_control'),
- 'redirect': (ITypesTool, 'object/folderContents',
+ 'redirect': ('portal_types', 'object/folderContents',
'b_start, key, reverse')},
{'id': 'items_down',
'permissions': (ManageProperties,),
'transform': ('validateItemIds', 'down_control'),
- 'redirect': (ITypesTool, 'object/folderContents',
+ 'redirect': ('portal_types', 'object/folderContents',
'b_start, key, reverse')},
{'id': 'items_top',
'permissions': (ManageProperties,),
'transform': ('validateItemIds', 'top_control'),
- 'redirect': (ITypesTool, 'object/folderContents',
+ 'redirect': ('portal_types', 'object/folderContents',
'b_start, key, reverse')},
{'id': 'items_bottom',
'permissions': (ManageProperties,),
'transform': ('validateItemIds', 'bottom_control'),
- 'redirect': (ITypesTool, 'object/folderContents',
+ 'redirect': ('portal_types', 'object/folderContents',
'b_start, key, reverse')},
{'id': 'set_view_filter',
'transform': ('set_filter_control',),
- 'redirect': (ITypesTool, 'object/folderContents')},
+ 'redirect': ('portal_types', 'object/folderContents')},
{'id': 'clear_view_filter',
'transform': ('clear_filter_control',),
- 'redirect': (ITypesTool, 'object/folderContents')})
+ 'redirect': ('portal_types', 'object/folderContents')})
# helpers
Modified: CMF/trunk/CMFDefault/browser/folder.txt
===================================================================
--- CMF/trunk/CMFDefault/browser/folder.txt 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/browser/folder.txt 2007-06-21 12:59:18 UTC (rev 76897)
@@ -12,17 +12,13 @@
>>> from zope.component import getSiteManager
>>> from Products.CMFCore.interfaces import IMembershipTool
>>> from Products.CMFCore.interfaces import IPropertiesTool
- >>> from Products.CMFCore.interfaces import ITypesTool
- >>> from Products.CMFCore.interfaces import IURLTool
>>> sm = getSiteManager()
>>> mtool = site._setObject('portal_membership', DummyTool())
>>> sm.registerUtility(mtool, IMembershipTool)
>>> ptool = site._setObject('portal_properties', DummyTool())
>>> sm.registerUtility(ptool, IPropertiesTool)
>>> ttool = site._setObject('portal_types', DummyTool())
- >>> sm.registerUtility(ttool, ITypesTool)
>>> utool = site._setObject('portal_url', DummyTool())
- >>> sm.registerUtility(utool, IURLTool)
Basic functionality without security setup:
Modified: CMF/trunk/CMFDefault/browser/metadata.py
===================================================================
--- CMF/trunk/CMFDefault/browser/metadata.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/browser/metadata.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -33,7 +33,6 @@
from Products.CMFCore.interfaces import IDiscussionTool
from Products.CMFCore.interfaces import IMutableDublinCore
from Products.CMFCore.interfaces import IMutableMinimalDublinCore
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFDefault.formlib.form import ContentEditFormBase
from Products.CMFDefault.formlib.schema import ProxyFieldProperty
from Products.CMFDefault.formlib.schema import SchemaAdapterBase
@@ -262,8 +261,8 @@
def handle_change_success(self, action, data):
self._handle_success(action, data)
- return self._setRedirect(ITypesTool, 'object/metadata')
+ return self._setRedirect('portal_types', 'object/metadata')
def handle_change_and_edit_success(self, action, data):
self._handle_success(action, data)
- return self._setRedirect(ITypesTool, 'object/edit')
+ return self._setRedirect('portal_types', 'object/edit')
Modified: CMF/trunk/CMFDefault/browser/utils.py
===================================================================
--- CMF/trunk/CMFDefault/browser/utils.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/browser/utils.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -22,7 +22,7 @@
from Products.CMFCore.interfaces import IMembershipTool
from Products.CMFCore.interfaces import IPropertiesTool
-from Products.CMFCore.interfaces import IURLTool
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.permissions import View
from Products.CMFDefault.utils import getBrowserCharset
from Products.CMFDefault.utils import toUnicode
@@ -67,13 +67,17 @@
# helpers
@memoize
+ def _getTool(self, name):
+ return getToolByName(self.context, name)
+
+ @memoize
def _checkPermission(self, permission):
mtool = getUtility(IMembershipTool)
return mtool.checkPermission(permission, self.context)
@memoize
def _getPortalURL(self):
- utool = getUtility(IURLTool)
+ utool = self._getTool('portal_url')
return utool()
@memoize
Modified: CMF/trunk/CMFDefault/formlib/form.py
===================================================================
--- CMF/trunk/CMFDefault/formlib/form.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/formlib/form.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -22,14 +22,12 @@
from Products.Five.formlib.formbase import PageDisplayForm
from Products.Five.formlib.formbase import PageForm
from zope.datetime import parseDatetimetz
-from zope.component import getUtility
from zope.formlib import form
from zope.i18n.interfaces import IUserPreferredLanguages
from zope.i18n.locales import LoadLocaleError
from zope.i18n.locales import locales
from ZTUtils import make_query
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFDefault.utils import Message as _
from Products.CMFDefault.utils import translate
from Products.CMFDefault.browser.utils import ViewBase
@@ -64,8 +62,8 @@
self.request = request
self.request.locale = getLocale(request)
- def _setRedirect(self, provider_iface, action_path, keys=''):
- provider = getUtility(provider_iface)
+ def _setRedirect(self, provider_id, action_path, keys=''):
+ provider = self._getTool(provider_id)
try:
target = provider.getActionInfo(action_path, self.context)['url']
except ValueError:
@@ -149,11 +147,11 @@
def handle_change_success(self, action, data):
self._handle_success(action, data)
- return self._setRedirect(ITypesTool, 'object/edit')
+ return self._setRedirect('portal_types', 'object/edit')
def handle_change_and_view_success(self, action, data):
self._handle_success(action, data)
- return self._setRedirect(ITypesTool, 'object/view')
+ return self._setRedirect('portal_types', 'object/view')
class DisplayFormBase(PageDisplayForm, ViewBase):
Modified: CMF/trunk/CMFDefault/profiles/default/componentregistry.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/componentregistry.xml 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/profiles/default/componentregistry.xml 2007-06-21 12:59:18 UTC (rev 76897)
@@ -3,21 +3,9 @@
<adapters/>
<utilities>
<utility
- interface="Products.CMFCore.interfaces.IActionsTool"
- object="/portal_actions"/>
- <utility
interface="Products.CMFCore.interfaces.ICachingPolicyManager"
object="/caching_policy_manager"/>
<utility
- interface="Products.CMFCore.interfaces.ICatalogTool"
- object="/portal_catalog"/>
- <utility
- interface="Products.CMFCore.interfaces.IContentTypeRegistry"
- object="/content_type_registry"/>
- <utility
- interface="Products.CMFCore.interfaces.ICookieCrumbler"
- object="/cookie_authentication"/>
- <utility
interface="Products.CMFCore.interfaces.IDiscussionTool"
object="/portal_discussion"/>
<utility
@@ -39,24 +27,12 @@
interface="Products.CMFCore.interfaces.ISiteRoot"
object="/"/>
<utility
- interface="Products.CMFCore.interfaces.ISkinsTool"
- object="/portal_skins"/>
- <utility
interface="Products.CMFCore.interfaces.ISyndicationTool"
object="/portal_syndication"/>
<utility
- interface="Products.CMFCore.interfaces.ITypesTool"
- object="/portal_types"/>
- <utility
interface="Products.CMFCore.interfaces.IUndoTool"
object="/portal_undo"/>
<utility
- interface="Products.CMFCore.interfaces.IURLTool"
- object="/portal_url"/>
- <utility
- interface="Products.CMFCore.interfaces.IConfigurableWorkflowTool"
- object="/portal_workflow"/>
- <utility
interface="Products.GenericSetup.interfaces.ISetupTool"
object="/portal_setup"/>
<utility
Modified: CMF/trunk/CMFDefault/skins/zpt_content/content_status_modify.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_content/content_status_modify.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_content/content_status_modify.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,12 +1,11 @@
##parameters=workflow_action, comment=''
##title=Modify the status of a content object
##
-from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.exceptions import WorkflowException
from Products.CMFDefault.utils import Message as _
-wtool_iface = 'Products.CMFCore.interfaces.IConfigurableWorkflowTool'
-wtool = getToolByInterfaceName(wtool_iface)
+wtool = getToolByName(script, 'portal_workflow')
try:
wtool.doActionFor(context, workflow_action, comment=comment)
Modified: CMF/trunk/CMFDefault/skins/zpt_control/setRedirect.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_control/setRedirect.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_control/setRedirect.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,10 +1,10 @@
##parameters=provider, action_path, **kw
##
from ZTUtils import make_query
-from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import getBrowserCharset
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/breadcrumbs.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/breadcrumbs.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/breadcrumbs.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -2,10 +2,11 @@
##title=Return breadcrumbs
##
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import Message as _
ptool = getToolByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
result = []
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/discussion_reply_form.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/discussion_reply_form.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/discussion_reply_form.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,12 +1,12 @@
##parameters=add='', edit='', preview=''
##
from Products.PythonScripts.standard import structured_text
-from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import html_marshal
from Products.CMFDefault.utils import Message as _
-atool = getToolByInterfaceName('Products.CMFCore.interfaces.IActionsTool')
+atool = getToolByName(script, 'portal_actions')
form = context.REQUEST.form
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/expanded_title.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/expanded_title.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/expanded_title.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -2,10 +2,10 @@
##parameters=
##title=Build title which includes site title
##
-from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
site_title = utool.getPortalObject().Title()
page_title = context.Title()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/folder_contents.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/folder_contents.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/folder_contents.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -3,6 +3,7 @@
from ZTUtils import Batch
from ZTUtils import make_query
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.permissions import AddPortalContent
from Products.CMFDefault.permissions import DeleteObjects
from Products.CMFDefault.permissions import ListFolderContents
@@ -13,7 +14,7 @@
from Products.CMFDefault.utils import Message as _
mtool = getToolByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/folder_rename_form.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/folder_rename_form.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/folder_rename_form.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,11 +1,11 @@
##parameters=b_start=0, key='', reverse=0, ids=(), new_ids=(), rename='', cancel=''
##
-from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import html_marshal
from Products.CMFDefault.utils import Message as _
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/getBatchItemInfos.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/getBatchItemInfos.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/getBatchItemInfos.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -2,9 +2,9 @@
##parameters=batch_obj
##title=
##
-from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
items = []
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/getMainGlobals.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/getMainGlobals.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/getMainGlobals.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,18 +1,17 @@
##parameters=
##
-
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import getBrowserCharset
-atool = getToolByInterfaceName('Products.CMFCore.interfaces.IActionsTool')
+atool = getToolByName(script, 'portal_actions')
caltool_iface = 'Products.CMFCalendar.interfaces.ICalendarTool'
caltool = getToolByInterfaceName(caltool_iface, None)
mtool = getToolByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
ptool = getToolByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
-wtool_iface = 'Products.CMFCore.interfaces.IConfigurableWorkflowTool'
-wtool = getToolByInterfaceName(wtool_iface)
+utool = getToolByName(script, 'portal_url')
+wtool = getToolByName(script, 'portal_workflow')
portal_object = utool.getPortalObject()
if not 'charset' in context.REQUEST.RESPONSE.getHeader('content-type'):
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/get_permalink.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/get_permalink.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/get_permalink.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -8,13 +8,11 @@
##title=Returns the permalink url or None
##
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
# calculate the permalink if the uid handler tool exists, permalinks
# are configured to be shown and the object is not folderish
-uidtool = getToolByInterfaceName( 'Products.CMFUid.interfaces.IUniqueIdHandler'
- , default=None
- )
-
+uidtool = getToolByName(context, 'portal_uidhandler', None)
if uidtool is not None:
ptool = getToolByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
showPermalink = getattr(ptool, 'enable_permalink', None)
@@ -22,7 +20,7 @@
if showPermalink and not isFolderish:
# returns the uid (generates one if necessary)
- utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+ urltool = getToolByName(context, 'portal_url')
uid = uidtool.register(context)
url = "%s/permalink/%s" % (utool(), uid)
return url
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/join_form.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/join_form.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/join_form.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,14 +1,15 @@
##parameters=b_start=0, member_id='', member_email='', password='', confirm='', send_password='', add='', cancel=''
##
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.permissions import ManageUsers
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import Message as _
-atool = getToolByInterfaceName('Products.CMFCore.interfaces.IActionsTool')
+atool = getToolByName(script, 'portal_actions')
mtool = getToolByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
ptool = getToolByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
validate_email = ptool.getProperty('validate_email')
is_anon = mtool.isAnonymousUser()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/logged_in.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/logged_in.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/logged_in.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,13 +1,14 @@
##parameters=
##
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import Message as _
mtool = getToolByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
ptool = getToolByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
-stool = getToolByInterfaceName('Products.CMFCore.interfaces.ISkinsTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+stool = getToolByName(script, 'portal_skins')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/members_delete_form.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/members_delete_form.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/members_delete_form.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,11 +1,11 @@
##parameters=ids, b_start=0, delete='', cancel=''
##
-from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import html_marshal
from Products.CMFDefault.utils import Message as _
-atool = getToolByInterfaceName('Products.CMFCore.interfaces.IActionsTool')
+atool = getToolByName(script, 'portal_actions')
form = context.REQUEST.form
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/members_manage_form.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/members_manage_form.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/members_manage_form.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -2,11 +2,12 @@
##
from ZTUtils import Batch
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import html_marshal
from Products.CMFDefault.utils import Message as _
-atool = getToolByInterfaceName('Products.CMFCore.interfaces.IActionsTool')
+atool = getToolByName(script, 'portal_actions')
mtool = getToolByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/news_box.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/news_box.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/news_box.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,10 +1,10 @@
##parameters=
##
from ZTUtils import Batch
-from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
-ctool = getToolByInterfaceName('Products.CMFCore.interfaces.ICatalogTool')
+ctool = getToolByName(script, 'portal_catalog')
options = {}
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/password_email.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/password_email.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/password_email.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,13 +1,14 @@
##parameters=member=None, password='secret'
##
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import makeEmail
from Products.CMFDefault.utils import Message as _
-atool = getToolByInterfaceName('Products.CMFCore.interfaces.IActionsTool')
+atool = getToolByName(script, 'portal_actions')
ptool = getToolByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/password_form.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/password_form.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/password_form.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,13 +1,14 @@
##parameters=change='', cancel=''
##
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import Message as _
-atool = getToolByInterfaceName('Products.CMFCore.interfaces.IActionsTool')
+atool = getToolByName(script, 'portal_actions')
mtool = getToolByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
ptool = getToolByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
member = mtool.getAuthenticatedMember()
portal_url = utool()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/recent_news.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/recent_news.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/recent_news.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -2,11 +2,11 @@
##
from Products.PythonScripts.standard import structured_text
from ZTUtils import Batch
-from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
-ctool = getToolByInterfaceName('Products.CMFCore.interfaces.ICatalogTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+ctool = getToolByName(script, 'portal_catalog')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/reconfig_form.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/reconfig_form.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/reconfig_form.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,10 +1,11 @@
##parameters=change=''
##
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import Message as _
-atool = getToolByInterfaceName('Products.CMFCore.interfaces.IActionsTool')
+atool = getToolByName(script, 'portal_actions')
ptool = getToolByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/registered_email.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/registered_email.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/registered_email.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,13 +1,14 @@
##parameters=member=None, password='secret', email='foo at example.org'
##
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import makeEmail
from Products.CMFDefault.utils import Message as _
-atool = getToolByInterfaceName('Products.CMFCore.interfaces.IActionsTool')
+atool = getToolByName(script, 'portal_actions')
ptool = getToolByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/rejectItems.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/rejectItems.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/rejectItems.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -7,12 +7,9 @@
##parameters=items, comment=''
##title=
##
+from Products.CMFCore.utils import getToolByName
-from Products.CMFCore.utils import getToolByInterfaceName
-
-wtool_iface = 'Products.CMFCore.interfaces.IConfigurableWorkflowTool'
-wtool = getToolByInterfaceName(wtool_iface)
-
+wtool = getToolByName(script, 'portal_workflow')
for path in items:
object = context.restrictedTraverse( path )
wtool.doActionFor( object, 'reject', comment=comment )
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/search.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/search.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/search.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -2,12 +2,12 @@
##
from Products.PythonScripts.standard import thousands_commas
from ZTUtils import Batch
-from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import Message as _
-ctool = getToolByInterfaceName('Products.CMFCore.interfaces.ICatalogTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+ctool = getToolByName(script, 'portal_catalog')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
epoch = DateTime('1970/01/01 00:00:01 GMT')
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/search_form.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/search_form.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/search_form.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -1,14 +1,15 @@
##parameters=search=''
##
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.permissions import ReviewPortalContent
from Products.CMFDefault.utils import decode
from Products.CMFDefault.utils import Message as _
-ctool = getToolByInterfaceName('Products.CMFCore.interfaces.ICatalogTool')
+ctool = getToolByName(script, 'portal_catalog')
mtool = getToolByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
-ttool = getToolByInterfaceName('Products.CMFCore.interfaces.ITypesTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+ttool = getToolByName(script, 'portal_types')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
Modified: CMF/trunk/CMFDefault/skins/zpt_generic/setup_talkback_tree.py
===================================================================
--- CMF/trunk/CMFDefault/skins/zpt_generic/setup_talkback_tree.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/skins/zpt_generic/setup_talkback_tree.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -3,11 +3,12 @@
##
from ZTUtils import SimpleTreeMaker
from Products.CMFCore.utils import getToolByInterfaceName
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.permissions import ManagePortal
from Products.CMFDefault.utils import decode
mtool = getToolByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
-utool = getToolByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+utool = getToolByName(script, 'portal_url')
portal_url = utool()
tm = SimpleTreeMaker('tb_tree')
Modified: CMF/trunk/CMFDefault/tests/test_DiscussionTool.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_DiscussionTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/tests/test_DiscussionTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -24,7 +24,6 @@
from Products.CMFCore.interfaces import IDiscussionTool
from Products.CMFCore.interfaces import IMembershipTool
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.tests.base.dummy import DummyFolder
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
@@ -45,7 +44,6 @@
self.site._setObject( 'portal_membership', DummyTool() )
sm.registerUtility(self.site.portal_membership, IMembershipTool)
self.site._setObject( 'portal_types', DummyTool() )
- sm.registerUtility(self.site.portal_types, ITypesTool)
def tearDown(self):
cleanUp()
Modified: CMF/trunk/CMFDefault/tests/test_Discussions.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_Discussions.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/tests/test_Discussions.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -22,10 +22,8 @@
from zope.interface.verify import verifyClass
from Products.CMFCore.CatalogTool import CatalogTool
-from Products.CMFCore.interfaces import ICatalogTool
from Products.CMFCore.interfaces import IDiscussionTool
from Products.CMFCore.interfaces import IMembershipTool
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.testing import EventZCMLLayer
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFCore.tests.base.dummy import DummySite
@@ -86,7 +84,6 @@
self.site._setObject( 'portal_membership', DummyTool() )
sm.registerUtility(self.site.portal_membership, IMembershipTool)
self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(self.site.portal_types, ITypesTool)
def _makeDummyContent(self, id, *args, **kw):
return self.site._setObject( id, DummyContent(id, *args, **kw) )
@@ -174,9 +171,7 @@
assert parents[ 0 ] == reply1
def test_itemCataloguing( self ):
- sm = getSiteManager()
ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
- sm.registerUtility(ctool, ICatalogTool)
dtool = self.site.portal_discussion
catalog = ctool._catalog
test = self._makeDummyContent('test', catalog=1)
@@ -238,9 +233,7 @@
DiscussionItem.notifyWorkflowCreated = old_method
def test_deletePropagation( self ):
- sm = getSiteManager()
ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
- sm.registerUtility(ctool, ICatalogTool)
dtool = self.site.portal_discussion
test = self._makeDummyContent('test', catalog=1)
test.allow_discussion = 1
@@ -254,10 +247,8 @@
self.assertEqual( len(ctool), 0 )
def test_deleteReplies(self):
- sm = getSiteManager()
dtool = self.site.portal_discussion
ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
- sm.registerUtility(ctool, ICatalogTool)
test = self._makeDummyContent('test')
test.allow_discussion = 1
Modified: CMF/trunk/CMFDefault/tests/test_Favorite.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_Favorite.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/tests/test_Favorite.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -24,7 +24,6 @@
from Products.CMFCore.interfaces import IMembershipTool
from Products.CMFCore.interfaces import ISiteRoot
-from Products.CMFCore.interfaces import IURLTool
from Products.CMFCore.testing import ConformsToContent
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
@@ -46,7 +45,6 @@
sm.registerUtility(self.site, ISiteRoot)
sm.registerUtility(DummyTool(), IMembershipTool)
self.site._setObject( 'portal_url', DummyTool() )
- sm.registerUtility(self.site.portal_url, IURLTool)
def tearDown(self):
cleanUp()
Modified: CMF/trunk/CMFDefault/tests/test_MembershipTool.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_MembershipTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/tests/test_MembershipTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -19,11 +19,9 @@
import Testing
from AccessControl.SecurityManagement import newSecurityManager
-from zope.component import getSiteManager
from zope.interface.verify import verifyClass
from zope.testing.cleanup import cleanUp
-from Products.CMFCore.interfaces import IConfigurableWorkflowTool
from Products.CMFCore.PortalFolder import PortalFolder
from Products.CMFCore.tests.base.dummy import DummyFolder
from Products.CMFCore.tests.base.dummy import DummySite
@@ -85,8 +83,6 @@
members = self.site._setObject( 'Members', PortalFolder('Members') )
acl_users = self.site._setObject( 'acl_users', DummyUserFolder() )
wtool = self.site._setObject( 'portal_workflow', DummyTool() )
- sm = getSiteManager()
- sm.registerUtility(self.site.portal_workflow, IConfigurableWorkflowTool)
# permission
mtool.createMemberArea('user_foo')
Modified: CMF/trunk/CMFDefault/tests/test_Portal.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_Portal.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/tests/test_Portal.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -22,16 +22,8 @@
from AccessControl.User import UnrestrictedUser
from Acquisition import aq_base
from zope.app.component.hooks import setSite
-from zope.component import getUtility
-from zope.component import queryUtility
-from Products.CMFCore.interfaces import ICatalogTool
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFDefault.testing import FunctionalLayer
-try:
- from Products.CMFUid.interfaces import IUniqueIdHandler
-except ImportError:
- IUniqueIdHandler = None
class CMFSiteTests(ZopeTestCase.FunctionalTestCase):
@@ -53,15 +45,15 @@
setSite(self.app.site)
def test_new( self ):
- catalog = getUtility(ICatalogTool)
+ catalog = self.app.site.portal_catalog
self.assertEqual(len(catalog), 0)
def test_MetadataCataloguing( self ):
site = self.app.site
- catalog = getUtility(ICatalogTool)
- ttool = getUtility(ITypesTool)
- uid_handler = IUniqueIdHandler and queryUtility(IUniqueIdHandler)
+ catalog = site.portal_catalog
+ ttool = site.portal_types
+ uid_handler = getattr(site, 'portal_uidhandler', None)
portal_types = [ x for x in ttool.listContentTypes()
if x not in ( 'Discussion Item'
@@ -108,7 +100,7 @@
def test_DocumentEditCataloguing( self ):
site = self.app.site
- catalog = getUtility(ICatalogTool)
+ catalog = site.portal_catalog
doc = self._makeContent( site
, portal_type='Document'
@@ -126,7 +118,7 @@
def test_ImageEditCataloguing( self ):
site = self.app.site
- catalog = getUtility(ICatalogTool)
+ catalog = site.portal_catalog
doc = self._makeContent( site
, portal_type='Image'
@@ -142,7 +134,7 @@
def test_FileEditCataloguing( self ):
site = self.app.site
- catalog = getUtility(ICatalogTool)
+ catalog = site.portal_catalog
doc = self._makeContent( site
, portal_type='File'
@@ -158,7 +150,7 @@
def test_LinkEditCataloguing( self ):
site = self.app.site
- catalog = getUtility(ICatalogTool)
+ catalog = site.portal_catalog
doc = self._makeContent( site
, portal_type='Link'
@@ -174,7 +166,7 @@
def test_NewsItemEditCataloguing( self ):
site = self.app.site
- catalog = getUtility(ICatalogTool)
+ catalog = site.portal_catalog
doc = self._makeContent( site
, portal_type='News Item'
Modified: CMF/trunk/CMFDefault/tests/test_SyndicationTool.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_SyndicationTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFDefault/tests/test_SyndicationTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -19,11 +19,9 @@
import Testing
from DateTime.DateTime import DateTime
-from zope.component import getSiteManager
from zope.interface.verify import verifyClass
from zope.testing.cleanup import cleanUp
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.tests.base.testcase import SecurityTest
@@ -178,14 +176,13 @@
from Products.CMFCore.PortalFolder import PortalFolder
from Products.CMFCore.CMFBTreeFolder import CMFBTreeFolder
from Products.CMFCore.TypesTool import TypesTool
- sm = getSiteManager()
+
PERIOD = 'hourly'
FREQUENCY = 4
NOW = DateTime()
MAX_ITEMS = 42
self.root._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(self.root.portal_types, ITypesTool)
self.root._setObject('pf', PortalFolder('pf'))
self.root._setObject('bf', CMFBTreeFolder('bf'))
self.root._setObject('portal_syndication', self._makeOne())
Modified: CMF/trunk/CMFTopic/Topic.py
===================================================================
--- CMF/trunk/CMFTopic/Topic.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFTopic/Topic.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -24,8 +24,8 @@
from zope.interface import implements
from Products.CMFDefault.SkinnedFolder import SkinnedFolder
-from Products.CMFCore.interfaces import ICatalogTool
from Products.CMFCore.interfaces import ISyndicationTool
+from Products.CMFCore.utils import getToolByName
from interfaces import IMutableTopic
from interfaces import ITopic
@@ -83,7 +83,7 @@
def listAvailableFields(self):
""" Return a list of available fields for new criteria.
"""
- portal_catalog = getUtility(ICatalogTool)
+ portal_catalog = getToolByName( self, 'portal_catalog' )
currentfields = map( lambda x: x.Field(), self.listCriteria() )
availfields = filter(
lambda field, cf=currentfields: field not in cf,
@@ -143,7 +143,7 @@
o Built-in criteria update any criteria passed in 'kw'.
"""
kw.update( self.buildQuery() )
- portal_catalog = getUtility(ICatalogTool)
+ portal_catalog = getToolByName( self, 'portal_catalog' )
return portal_catalog.searchResults(REQUEST, **kw)
security.declareProtected(View, 'synContentValues')
Modified: CMF/trunk/CMFTopic/tests/test_Topic.py
===================================================================
--- CMF/trunk/CMFTopic/tests/test_Topic.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFTopic/tests/test_Topic.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -24,9 +24,7 @@
from zope.component import getSiteManager
from zope.interface.verify import verifyClass
-from Products.CMFCore.interfaces import ICatalogTool
from Products.CMFCore.interfaces import ISyndicationTool
-from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.testing import ConformsToFolder
from Products.CMFCore.testing import EventZCMLLayer
from Products.CMFCore.tests.base.dummy import DummySite
@@ -146,7 +144,6 @@
def _initSite(self, max_items=15, index_ids=()):
sm = getSiteManager()
self.site.portal_catalog = DummyCatalog( index_ids )
- sm.registerUtility(self.site.portal_catalog, ICatalogTool)
self.site.portal_syndication = DummySyndicationTool( max_items )
sm.registerUtility(self.site.portal_syndication, ISyndicationTool)
@@ -198,9 +195,7 @@
self.assertEqual( query[ 'baz' ], 43 )
def test_Nested( self ):
- sm = getSiteManager()
self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(self.site.portal_types, ITypesTool)
self.site.portal_types._setObject('Topic', FTI(id='Topic',
product='CMFTopic', factory='addTopic'))
topic = self._makeOne('top')
Modified: CMF/trunk/CMFUid/UniqueIdAnnotationTool.py
===================================================================
--- CMF/trunk/CMFUid/UniqueIdAnnotationTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFUid/UniqueIdAnnotationTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -28,10 +28,10 @@
from zope.interface import implements
from Products.CMFCore.ActionProviderBase import ActionProviderBase
+from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import registerToolInterface
from Products.CMFCore.utils import UniqueObject
-from Products.CMFUid.interfaces import IUniqueIdHandler
from Products.CMFUid.interfaces import IUniqueIdAnnotation
from Products.CMFUid.interfaces import IUniqueIdAnnotationManagement
from Products.CMFUid.interfaces import UniqueIdError
@@ -77,7 +77,7 @@
if IObjectAddedEvent.providedBy(event):
if event.newParent is not None:
anno_tool = queryUtility(IUniqueIdAnnotationManagement)
- uid_handler = queryUtility(IUniqueIdHandler)
+ uid_handler = getToolByName(ob, 'portal_uidhandler')
if anno_tool is not None:
remove_on_add = anno_tool.getProperty('remove_on_add',False)
remove_on_clone = anno_tool.getProperty('remove_on_clone',False)
@@ -95,7 +95,8 @@
elif IObjectClonedEvent.providedBy(event):
anno_tool = queryUtility(IUniqueIdAnnotationManagement)
- uid_handler = queryUtility(IUniqueIdHandler)
+ uid_handler = getToolByName(ob, 'portal_uidhandler')
+
if anno_tool is not None:
remove_on_clone = anno_tool.getProperty('remove_on_clone', False)
assign_on_clone = anno_tool.getProperty('assign_on_clone', False)
Modified: CMF/trunk/CMFUid/UniqueIdHandlerTool.py
===================================================================
--- CMF/trunk/CMFUid/UniqueIdHandlerTool.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFUid/UniqueIdHandlerTool.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -31,9 +31,8 @@
from zope.interface import implements
from Products.CMFCore.ActionProviderBase import ActionProviderBase
-from Products.CMFCore.interfaces import ICatalogTool
from Products.CMFCore.permissions import ManagePortal
-from Products.CMFCore.utils import registerToolInterface
+from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import UniqueObject
from Products.CMFUid.interfaces import IUniqueIdAnnotationManagement
@@ -78,7 +77,9 @@
security = ClassSecurityInfo()
def _reindexObject(self, obj):
- catalog = getUtility(ICatalogTool)
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on a non-utility tool
+ catalog = getToolByName(self, 'portal_catalog')
catalog.reindexObject(obj, idxs=[self.UID_ATTRIBUTE_NAME])
def _setUid(self, obj, uid):
@@ -165,6 +166,8 @@
"""This helper method does the "hard work" of querying the catalog
and interpreting the results.
"""
+ # XXX: this method violates the rules for tools/utilities:
+ # it depends on a non-utility tool
if uid is None:
return default
@@ -172,7 +175,7 @@
generator = getUtility(IUniqueIdGenerator)
uid = generator.convert(uid)
- catalog = getUtility(ICatalogTool)
+ catalog = getToolByName(self, 'portal_catalog')
searchMethod = getattr(catalog, searchMethodName)
result = searchMethod({self.UID_ATTRIBUTE_NAME: uid})
len_result = len(result)
@@ -253,4 +256,3 @@
manage_queryObject = PageTemplateFile('queryUID.pt', _wwwdir)
InitializeClass(UniqueIdHandlerTool)
-registerToolInterface('portal_uidhandler', IUniqueIdHandler)
Modified: CMF/trunk/CMFUid/profiles/default/componentregistry.xml
===================================================================
--- CMF/trunk/CMFUid/profiles/default/componentregistry.xml 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFUid/profiles/default/componentregistry.xml 2007-06-21 12:59:18 UTC (rev 76897)
@@ -6,9 +6,6 @@
interface="Products.CMFUid.interfaces.IUniqueIdGenerator"
object="/portal_uidgenerator"/>
<utility
- interface="Products.CMFUid.interfaces.IUniqueIdHandler"
- object="/portal_uidhandler"/>
- <utility
interface="Products.CMFUid.interfaces.IUniqueIdAnnotationManagement"
object="/portal_uidannotation"/>
</utilities>
Modified: CMF/trunk/CMFUid/tests/test_uidannotation.py
===================================================================
--- CMF/trunk/CMFUid/tests/test_uidannotation.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFUid/tests/test_uidannotation.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -83,8 +83,6 @@
sm.registerUtility( self.root.portal_uidannotation
, IUniqueIdAnnotationManagement
)
- sm.registerUtility( self.root.portal_uidhandler
- , IUniqueIdHandler)
self.root._setObject('dummy', DummyContent(id='dummy'))
self.root._setObject('site', SimpleFolder('site'))
Modified: CMF/trunk/CMFUid/tests/test_uidhandling.py
===================================================================
--- CMF/trunk/CMFUid/tests/test_uidhandling.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/CMFUid/tests/test_uidhandling.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -22,7 +22,6 @@
from zope.interface.verify import verifyClass
from zope.testing.cleanup import cleanUp
-from Products.CMFCore.interfaces import ICatalogTool
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFCore.tests.base.dummy import DummyFolder
from Products.CMFCore.tests.base.testcase import SecurityTest
@@ -59,12 +58,10 @@
self.root._setObject('dummy2', DummyContent(id='dummy2'))
sm = getSiteManager()
- sm.registerUtility(self.root.portal_catalog, ICatalogTool)
sm.registerUtility( self.root.portal_uidannotation
, IUniqueIdAnnotationManagement
)
sm.registerUtility(self.root.portal_uidgenerator, IUniqueIdGenerator)
- sm.registerUtility(self.root.portal_uidhandler, IUniqueIdHandler)
# Make sure we have our indices/columns
uid_name = self.root.portal_uidhandler.UID_ATTRIBUTE_NAME
Modified: CMF/trunk/DCWorkflow/DCWorkflow.py
===================================================================
--- CMF/trunk/DCWorkflow/DCWorkflow.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/DCWorkflow/DCWorkflow.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -25,13 +25,12 @@
from Globals import InitializeClass
from OFS.Folder import Folder
from OFS.ObjectManager import bad_id
-from zope.component import getUtility
from zope.event import notify
from zope.interface import implements
# CMFCore
-from Products.CMFCore.interfaces import ICatalogTool
from Products.CMFCore.interfaces import IWorkflowDefinition
+from Products.CMFCore.utils import getToolByName
from Products.CMFCore.WorkflowCore import ObjectDeleted
from Products.CMFCore.WorkflowCore import ObjectMoved
from Products.CMFCore.WorkflowCore import WorkflowException
@@ -229,7 +228,7 @@
var_match_keys = qdef.getVarMatchKeys()
if var_match_keys:
# Check the catalog for items in the worklist.
- catalog = getUtility(ICatalogTool)
+ catalog = getToolByName(self, 'portal_catalog')
kw = {}
for k in var_match_keys:
v = qdef.getVarMatch(k)
Modified: CMF/trunk/DCWorkflow/tests/test_exportimport.py
===================================================================
--- CMF/trunk/DCWorkflow/tests/test_exportimport.py 2007-06-21 12:34:24 UTC (rev 76896)
+++ CMF/trunk/DCWorkflow/tests/test_exportimport.py 2007-06-21 12:59:18 UTC (rev 76897)
@@ -18,8 +18,6 @@
import unittest
import Testing
-from zope.component import getSiteManager
-
from Products.PythonScripts.PythonScript import PythonScript
from Products.ExternalMethod.ExternalMethod import ExternalMethod
@@ -29,7 +27,6 @@
import _EMPTY_TOOL_EXPORT
from Products.CMFCore.exportimport.tests.test_workflow \
import _WorkflowSetup as WorkflowSetupBase
-from Products.CMFCore.interfaces import IConfigurableWorkflowTool
from Products.CMFCore.testing import DummyWorkflow
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
from Products.DCWorkflow.testing import ExportImportZCMLLayer
@@ -76,9 +73,7 @@
def _initDCWorkflow( self, workflow_id ):
- sm = getSiteManager()
wf_tool = self.root.site.portal_workflow
- sm.registerUtility(wf_tool, IConfigurableWorkflowTool)
wf_tool._setObject( workflow_id, DCWorkflowDefinition( workflow_id ) )
return wf_tool._getOb( workflow_id )
More information about the CMF-checkins
mailing list