[CMF-checkins] CVS: CMF - ActionsTool.py:1.10 DiscussionTool.py:1.4 DynamicType.py:1.9 PortalFolder.py:1.16 TypesTool.py:1.15
tseaver@digicool.com
tseaver@digicool.com
Wed, 6 Jun 2001 20:24:16 -0400 (EDT)
Update of /cvs-repository/CMF/CMFCore
In directory korak.digicool.com:/tmp/cvs-serv13413/CMFCore
Modified Files:
ActionsTool.py DiscussionTool.py DynamicType.py
PortalFolder.py TypesTool.py
Log Message:
- Merge changes to permit mapping non-CMF classes onto content
types (Tracker #283).
--- Updated File ActionsTool.py in package CMF --
--- ActionsTool.py 2001/06/01 15:07:28 1.9
+++ ActionsTool.py 2001/06/07 00:23:45 1.10
@@ -194,25 +194,25 @@
# Include actions from object.
if object is not None:
base = aq_base(object)
- if hasattr(base, 'getTypeInfo'):
- ti = object.getTypeInfo()
- if ti is not None:
- defs = ti.getActions()
- if defs:
- c_url = info.content_url
- for d in defs:
- a = d['action']
- if a:
- url = c_url + '/' + a
- else:
- url = c_url
- actions.append({
- 'id': d.get('id', None),
- 'name': d['name'],
- 'url': url,
- 'permissions': d['permissions'],
- 'category': d.get('category', 'object'),
- })
+ types_tool = getToolByName( self, 'portal_types' )
+ ti = types_tool.getTypeInfo( object )
+ if ti is not None:
+ defs = ti.getActions()
+ if defs:
+ c_url = info.content_url
+ for d in defs:
+ a = d['action']
+ if a:
+ url = c_url + '/' + a
+ else:
+ url = c_url
+ actions.append({
+ 'id': d.get('id', None),
+ 'name': d['name'],
+ 'url': url,
+ 'permissions': d['permissions'],
+ 'category': d.get('category', 'object'),
+ })
if hasattr(base, 'listActions'):
a = object.listActions(info)
if a:
--- Updated File DiscussionTool.py in package CMF --
--- DiscussionTool.py 2001/05/11 03:38:28 1.3
+++ DiscussionTool.py 2001/06/07 00:23:45 1.4
@@ -211,8 +211,7 @@
'''
if hasattr( content, 'allow_discussion' ):
return content.allow_discussion
- typeInfo = getToolByName(self, 'portal_types').getTypeInfo(
- content.Type())
+ typeInfo = getToolByName(self, 'portal_types').getTypeInfo( content )
if typeInfo:
return typeInfo.allowDiscussion()
return 0
--- Updated File DynamicType.py in package CMF --
--- DynamicType.py 2001/04/30 19:35:10 1.8
+++ DynamicType.py 2001/06/07 00:23:45 1.9
@@ -126,8 +126,7 @@
tool = getToolByName(self, 'portal_types', None)
if tool is None:
return None
- pt = self._getPortalTypeName()
- return tool.getTypeInfo(pt) # Can return None.
+ return tool.getTypeInfo(self) # Can return None.
# Support for dynamic icons
--- Updated File PortalFolder.py in package CMF --
--- PortalFolder.py 2001/06/05 21:43:31 1.15
+++ PortalFolder.py 2001/06/07 00:23:45 1.16
@@ -163,8 +163,7 @@
"""
result = []
portal_types = getToolByName(self, 'portal_types')
- pt = self._getPortalTypeName()
- myType = portal_types.getTypeInfo(pt)
+ myType = portal_types.getTypeInfo(self)
if myType is not None:
for contentType in portal_types.listTypeInfo():
@@ -293,7 +292,8 @@
"""
Implement dublin core type
"""
- ti = self.getTypeInfo()
+ portal_types = getToolByName(self, 'portal_types')
+ ti = portal_types.getTypeInfo(self)
if ti is not None:
return ti.Type()
return self.meta_type
--- Updated File TypesTool.py in package CMF --
--- TypesTool.py 2001/06/05 21:43:31 1.14
+++ TypesTool.py 2001/06/07 00:23:45 1.15
@@ -666,8 +666,15 @@
"""
Return an instance which implements the
TypeInformation interface, corresponding to
- the specified 'contentType'.
+ the specified 'contentType'. If contentType is actually
+ an object, rather than a string, attempt to look up
+ the appropriate type info using its Type or meta_type.
"""
+ if type( contentType ) is not type( '' ):
+ try:
+ contentType = contentType._getPortalTypeName()
+ except:
+ contentType = contentType.meta_type
ob = getattr( self, contentType, None )
if getattr(aq_base(ob), '_isTypeInformation', 0):
return ob