[kupu-checkins] r42337 - kupu/trunk/kupu/plone
wiggy at codespeak.net
wiggy at codespeak.net
Wed Apr 25 23:18:11 CEST 2007
Author: wiggy
Date: Wed Apr 25 23:18:10 2007
New Revision: 42337
Modified:
kupu/trunk/kupu/plone/plonedrawers.py
kupu/trunk/kupu/plone/util.py
Log:
Remove getUtility related code; the getToolByName deprecation has been removed from CMF 2.1
Modified: kupu/trunk/kupu/plone/plonedrawers.py
==============================================================================
--- kupu/trunk/kupu/plone/plonedrawers.py (original)
+++ kupu/trunk/kupu/plone/plonedrawers.py Wed Apr 25 23:18:10 2007
@@ -523,7 +523,7 @@
if allow_browse and context is not portal:
parent = context.aq_parent
- pt = getattr(parent.aq_base, 'portal_type', None)
+ pt = getattr(parent, 'portal_type', None)
if pt in collection_type.portal_types:
data = self.getSingleObjectInfo(parent, resource_type)
data['label'] = '.. (Parent folder)'
Modified: kupu/trunk/kupu/plone/util.py
==============================================================================
--- kupu/trunk/kupu/plone/util.py (original)
+++ kupu/trunk/kupu/plone/util.py Wed Apr 25 23:18:10 2007
@@ -13,53 +13,8 @@
# trying to get rid of some deprecation warnings in a
# backwards compatible way
-try:
- from zope.component import getUtility
- from zope.component.interfaces import ComponentLookupError
- HAVE_GET_UTILITY = True
-except ImportError:
- HAVE_GET_UTILITY = False
-from Products.CMFCore.utils import getToolByName as gtbn
-
-if HAVE_GET_UTILITY:
- INTERFACEMAP = {
- 'portal_catalog': ('Products.CMFCore.interfaces', 'ICatalogTool'),
- 'portal_memberdata': ('Products.CMFCore.interfaces', 'IMemberDataTool'),
- 'portal_membership': ('Products.CMFCore.interfaces', 'IMembershipTool'),
- 'portal_types': ('Products.CMFCore.interfaces', 'ITypesTool'),
- 'portal_url': ('Products.CMFCore.interfaces', 'IURLTool'),
- 'portal_workflow': ('Products.CMFCore.interfaces', 'IWorkflowTool'),
- 'plone_utils': ('Products.CMFPlone.interfaces', 'IPloneTool'),
- 'portal_interface': ('Products.CMFPlone.interfaces', 'IInterfaceTool'),
- 'portal_skins': ('Products.CMFPlone.interfaces', 'ISkinsContainer'),
- 'content_type_registry': ('Products.CMFPlone.interfaces', 'IContentTypeRegistry'),
- 'portal_quickinstaller': ('Products.CMFQuickInstallerTool.interfaces', 'IQuickInstallerTool'),
- 'archetype_tool': ('Products.Archetypes.interfaces', 'IArchetypeTool'),
- 'reference_catalog': ('Products.Archetypes.interfaces', 'IReferenceCatalog'),
- 'uid_catalog': ('Products.Archetypes.interfaces', 'IUIDCatalog'),
- 'mimetypes_registry': ('Products.MimetypesRegistry.interfaces', 'IMimetypesRegistryTool'),
- 'portal_transforms': ('Products.PortalTransforms.interfaces', 'IPortalTransformsTool'),
- 'kupu_library_tool': ('Products.kupu.plone.z3interfaces', 'IPloneKupuLibraryTool'),
- }
- iname_mapping = {}
- for id, (module, interface) in INTERFACEMAP.iteritems():
- mod = __import__(module, globals(), locals(), [interface])
- if hasattr(mod, interface):
- iname_mapping[id] = getattr(mod, interface)
-
-
-security.declarePublic('getToolByName')
-def getToolByName(context, tool_name, default=None):
- if HAVE_GET_UTILITY:
- interface = iname_mapping.get(tool_name, None)
- if interface is not None:
- try:
- return getUtility(interface)
- except ComponentLookupError:
- # Behave in backward compatible way
- # fall through to old implementation
- pass
- return gtbn(context, tool_name, default)
+from Products.CMFCore.utils import getToolByName
+
def register_layer(self, relpath, name, out, add=True):
"""Register a file system directory as skin layer
More information about the kupu-checkins
mailing list