[CMF-checkins] SVN: CMF/branches/jens_tools_as_utilities/CMF - now that we have the "auto-wrapping" component registry the spurious

Jens Vagelpohl jens at dataflake.org
Sun Mar 4 07:23:07 EST 2007


Log message for revision 72967:
  - now that we have the "auto-wrapping" component registry the spurious
    tool wrapping to "make things work" can go away.
  

Changed:
  U   CMF/branches/jens_tools_as_utilities/CMFCore/ActionInformation.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/CMFCatalogAware.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/CachingPolicyManager.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/Expression.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/MemberDataTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/MembershipTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/PortalFolder.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/RegistrationTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/actions.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/content.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/base/dummy.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/utils.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/DublinCore.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/RegistrationTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/browser/utils.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/formlib/schema.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/utils.py

-=-
Modified: CMF/branches/jens_tools_as_utilities/CMFCore/ActionInformation.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/ActionInformation.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/ActionInformation.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -504,7 +504,7 @@
 
     def __init__( self, tool, folder, object=None ):
         self.portal = portal = aq_parent(aq_inner(tool))
-        membership = getUtility(IMembershipTool).__of__(portal)
+        membership = getUtility(IMembershipTool)
         self.isAnonymous = membership.isAnonymousUser()
         self.user_id = membership.getAuthenticatedMember().getId()
         self.portal_url = portal.absolute_url()

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/CMFCatalogAware.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/CMFCatalogAware.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/CMFCatalogAware.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -118,7 +118,6 @@
         if catalog is None:
             return
         path = '/'.join(self.getPhysicalPath())
-        catalog = catalog.__of__(self)
 
         # XXX if _getCatalogTool() is overriden we will have to change
         # this method for the sub-objects.

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/CachingPolicyManager.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/CachingPolicyManager.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/CachingPolicyManager.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -65,7 +65,6 @@
         for use by CachingPolicy objects.
     """
     pm = queryUtility(IMembershipTool)
-    pm = pm and pm.__of__(content)
     if not pm or pm.isAnonymousUser():
         member = None
     else:

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -73,7 +73,7 @@
         tool = queryUtility(ITypesTool)
         if tool is None:
             return None
-        return tool.__of__(self).getTypeInfo(self)  # Can return None.
+        return tool.getTypeInfo(self)  # Can return None.
 
     security.declarePublic('getActionInfo')
     def getActionInfo(self, action_chain, check_visibility=0,
@@ -106,7 +106,7 @@
                     return icon
                 else:
                     # Relative to REQUEST['BASEPATH1']
-                    portal_url = getUtility(IURLTool).__of__(self)
+                    portal_url = getUtility(IURLTool)
                     res = portal_url(relative=1) + '/' + icon
                     while res[:1] == '/':
                         res = res[1:]

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/Expression.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/Expression.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/Expression.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -67,7 +67,7 @@
     else:
         ec = None
     if ec is None:
-        utool = getUtility(IURLTool).__of__(context)
+        utool = getUtility(IURLTool)
         portal = utool.getPortalObject()
         if object is None or not hasattr(object, 'aq_base'):
             folder = portal
@@ -91,7 +91,7 @@
     '''
     An expression context provides names for TALES expressions.
     '''
-    pm = getUtility(IMembershipTool).__of__(portal)
+    pm = getUtility(IMembershipTool)
     if object is None:
         object_url = ''
     else:

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/MemberDataTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/MemberDataTool.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/MemberDataTool.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -184,7 +184,7 @@
     def pruneMemberDataContents(self):
         """ Delete data contents of all members not listet in acl_users.
         """
-        membertool= getUtility(IMembershipTool).__of__(self)
+        membertool= getUtility(IMembershipTool)
         members = self._members
         user_list = membertool.listMemberIds()
 

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/MembershipTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/MembershipTool.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/MembershipTool.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -148,7 +148,6 @@
 
         mdtool = queryUtility(IMemberDataTool)
         if mdtool is not None:
-            mdtool = mdtool.__of__(self)
             try:
                 u = mdtool.wrapUser(u)
             except ConflictError:
@@ -504,7 +503,6 @@
         # Delete member data in portal_memberdata.
         mdtool = queryUtility(IMemberDataTool)
         if mdtool is not None:
-            mdtool = mdtool.__of__(self)
             for member_id in member_ids:
                 mdtool.deleteMemberData(member_id)
 
@@ -515,7 +513,7 @@
 
         # Delete members' local roles.
         if delete_localroles:
-            utool = getUtility(IURLTool).__of__(self)
+            utool = getUtility(IURLTool)
             self.deleteLocalRoles( utool.getPortalObject(), member_ids,
                                    reindex=1, recursive=1 )
 

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/PortalFolder.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/PortalFolder.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/PortalFolder.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -125,7 +125,7 @@
             this folder.
         """
         result = []
-        portal_types = getUtility(ITypesTool).__of__(self)
+        portal_types = getUtility(ITypesTool)
         myType = portal_types.getTypeInfo(self)
 
         if myType is not None:

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/RegistrationTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/RegistrationTool.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/RegistrationTool.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -159,7 +159,7 @@
         # Anyone is always allowed to grant the 'Member' role.
         _limitGrantedRoles(roles, self, ('Member',))
 
-        membership = getUtility(IMembershipTool).__of__(self)
+        membership = getUtility(IMembershipTool)
         membership.addMember(id, password, roles, domains, properties)
 
         member = membership.getMemberById(id)
@@ -174,7 +174,7 @@
             return 0
         if not self._ALLOWED_MEMBER_ID_PATTERN.match( id ):
             return 0
-        membership = getUtility(IMembershipTool).__of__(self)
+        membership = getUtility(IMembershipTool)
         if membership.getMemberById(id) is not None:
             return 0
         return 1

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/actions.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/actions.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/actions.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -149,7 +149,7 @@
         # BBB: for CMF 1.6 profiles
         fragment = self._doc.createDocumentFragment()
         provider_iface = getToolInterface(provider_id)
-        provider = getUtility(provider_iface).__of__(self.context)
+        provider = getUtility(provider_iface)
 
         if not (IActionProvider.providedBy(provider) or
                 z2IActionProvider.isImplementedBy(provider)):

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/content.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/content.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/content.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -181,7 +181,7 @@
         context = self.context
         properties = import_context.readDataFile('.properties',
                                                  '%s/%s' % (subdir, id))
-        tool = getUtility(ITypesTool).__of__(context)
+        tool = getUtility(ITypesTool)
 
         try:
             tool.constructContent(portal_type, context, id)

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/tests/base/dummy.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/tests/base/dummy.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/base/dummy.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -293,7 +293,10 @@
     def userdefined_roles(self):
         return ('Member', 'Reviewer')
 
+    def getProperty(self, id, default=None):
+        return getattr(self, id, default)
 
+
 class DummyUser(Implicit):
     """ A dummy User.
     """

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/utils.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/utils.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/utils.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -103,8 +103,7 @@
                tool_interface.__name__), DeprecationWarning, stacklevel=2) 
 
         try:
-            tool = getUtility(tool_interface)
-            return tool.__of__(obj)
+            return getUtility(tool_interface)
         except ComponentLookupError:
             # behave in backwards-compatible way
             # fall through to old implementation
@@ -136,7 +135,7 @@
         return default
 
     try:
-        return getUtility(iface).__of__(obj)
+        return getUtility(iface)
     except ComponentLookupError:
         if default is _marker:
             raise

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/DublinCore.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/DublinCore.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/DublinCore.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -110,7 +110,6 @@
         """
         if creator is None:
             mtool = queryUtility(IMembershipTool)
-            mtool = mtool and mtool.__of__(self)
             creator = mtool and mtool.getAuthenticatedMember().getId()
 
         # call self.listCreators() to make sure self.creators exists

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/RegistrationTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/RegistrationTool.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/RegistrationTool.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -132,7 +132,7 @@
 
         o Raise an exception if user ID is not found.
         """
-        membership = getUtility(IMembershipTool).__of__(self)
+        membership = getUtility(IMembershipTool)
         member = membership.getMemberById(forgotten_userid)
 
         if member is None:
@@ -161,7 +161,7 @@
     def registeredNotify( self, new_member_id, password=None ):
         """ Handle mailing the registration / welcome message.
         """
-        membership = getUtility(IMembershipTool).__of__(self)
+        membership = getUtility(IMembershipTool)
         member = membership.getMemberById( new_member_id )
 
         if member is None:

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/browser/utils.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/browser/utils.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/browser/utils.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -81,8 +81,7 @@
 
     @memoize
     def _getToolByInterface(self, iface):
-        tool = getUtility(iface)
-        return  tool.__of__(self.context)
+        return getUtility(iface)
 
     @memoize
     def _getToolByInterfaceName(self, dotted_name):

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/formlib/schema.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/formlib/schema.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/formlib/schema.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -33,7 +33,7 @@
 
     def __init__(self, context):
         self.context = context
-        ptool = getUtility(IPropertiesTool).__of__(context)
+        ptool = getUtility(IPropertiesTool)
         self.encoding = ptool.getProperty('default_charset', None)
 
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/utils.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/utils.py	2007-03-03 14:47:07 UTC (rev 72966)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/utils.py	2007-03-04 12:23:03 UTC (rev 72967)
@@ -448,7 +448,7 @@
 def decode(value, context):
     """ Decode value using default_charset.
     """
-    ptool = getUtility(IPropertiesTool).__of__(context)
+    ptool = getUtility(IPropertiesTool)
     default_charset = ptool.getProperty('default_charset', None)
     return toUnicode(value, default_charset)
 
@@ -476,7 +476,7 @@
 def makeEmail(mtext, context, headers={}):
     """ Make email message.
     """
-    ptool = getUtility(IPropertiesTool).__of__(context)
+    ptool = getUtility(IPropertiesTool)
     email_charset = ptool.getProperty('email_charset', None) or 'utf-8'
     try:
         msg = MIMEText(mtext.encode(), 'plain')



More information about the CMF-checkins mailing list