[CMF-checkins] CVS: CMF/CMFDefault - DublinCore.py:1.19 MetadataTool.py:1.16
Florent Guillaume
fg@nuxeo.com
Fri, 5 Jul 2002 15:45:35 -0400
Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv2727/CMFDefault
Modified Files:
DublinCore.py MetadataTool.py
Log Message:
Fixed the Types Tool so that TypeInformation's Title is decorrelated
from its Id (the old TypeInformation.Type() should not be used anymore).
The Id is what gets put in the "portal_type" attribute of a content
object, which one gets at using somecontent.getPortalTypeName(). The
Title is returned by somecontent.Type().
"portal_type" is now indexed, and in most cases should be used when
doing catalog queries instead of "Type". Note that when upgrading from
older versions this index will have to be added by hand (see
INSTALL.txt).
Fixed PortalFolder's filtering so that it correctly restricts itself to
the portal types allowed by the TypesTool (Tracker #483).
=== CMF/CMFDefault/DublinCore.py 1.18 => 1.19 ===
ti = self.getTypeInfo()
if ti is not None:
- return ti.Type()
+ return ti.Title()
return self.meta_type
security.declarePublic( 'Format' )
=== CMF/CMFDefault/MetadataTool.py 1.15 => 1.16 ===
def listAllowedVocabulary( self, element, content=None, content_type=None ):
"""
- List allowed keywords for a given meta_type, or all
+ List allowed keywords for a given portal_type, or all
possible keywords if none supplied.
"""
spec = self.getElementSpec( element )
- if content_type is None:
- content_type = content and content.Type() or None
+ if content_type is None and content:
+ content_type = content.getPortalTypeName()
return spec.getPolicy( content_type ).allowedVocabulary()
security.declarePublic( 'listAllowedSubjects' )
def listAllowedSubjects( self, content=None, content_type=None ):
"""
- List allowed keywords for a given meta_type, or all
+ List allowed keywords for a given portal_type, or all
possible keywords if none supplied.
"""
return self.listAllowedVocabulary( 'Subject', content, content_type )
@@ -492,7 +492,7 @@
def listAllowedFormats( self, content=None, content_type=None ):
"""
List the allowed 'Content-type' values for a particular
- meta_type, or all possible formats if none supplied.
+ portal_type, or all possible formats if none supplied.
"""
return self.listAllowedVocabulary( 'Format', content, content_type )
@@ -519,7 +519,7 @@
Set initial values for content metatdata, supplying
any site-specific defaults.
"""
- for element, policy in self.listPolicies( content.Type() ):
+ for element, policy in self.listPolicies(content.getPortalTypeName()):
if not getattr( content, element )():
@@ -542,7 +542,7 @@
by the CMF immediately before saving changes to the
metadata of an object.
"""
- for element, policy in self.listPolicies( content.Type() ):
+ for element, policy in self.listPolicies(content.getPortalTypeName()):
value = getattr( content, element )()
if not value and policy.isRequired():