[CMF-checkins] CVS: Products/CMFDefault - MetadataTool.py:1.7
Tres Seaver
tseaver@digicool.com
Mon, 30 Jul 2001 23:34:36 -0400
Update of /cvs-repository/Products/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv1290/CMFDefault
Modified Files:
MetadataTool.py
Log Message:
- Extend metadata tool to allow adding / removing element specs.
=== Products/CMFDefault/MetadataTool.py 1.6 => 1.7 ===
security.declareProtected( CMFCorePermissions.ManagePortal
, 'addElementSpec' )
- def addElementSpec( self, element, is_multi_valued ):
+ def addElementSpec( self, element, is_multi_valued, REQUEST=None ):
"""
Add 'element' to our list of managed elements.
"""
@@ -472,14 +472,26 @@
self.element_specs[ element ] = ElementSpec( is_multi_valued )
+ if REQUEST is not None:
+ REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
+ + '/propertiesForm'
+ + '?manage_tabs_message=Element+' + element + '+added.'
+ )
+
security.declareProtected( CMFCorePermissions.ManagePortal
, 'removeElementSpec' )
- def removeElementSpec( self, element ):
+ def removeElementSpec( self, element, REQUEST=None ):
"""
Remove 'element' from our list of managed elements.
"""
del self.element_specs[ element ]
+ if REQUEST is not None:
+ REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
+ + '/propertiesForm'
+ + '?manage_tabs_message=Element+' + element + '+removed.'
+ )
+
security.declareProtected( CMFCorePermissions.ManagePortal, 'listPolicies' )
def listPolicies( self, typ=None ):
"""
@@ -513,8 +525,8 @@
"""
return self.publisher
- security.declarePrivate( '_listAllowedVocabulary' )
- def _listAllowedVocabulary( self, element, content=None ):
+ security.declarePublic( 'listAllowedVocabulary' )
+ def listAllowedVocabulary( self, element, content=None ):
"""
List allowed keywords for a given meta_type, or all
possible keywords if none supplied.
@@ -529,7 +541,7 @@
List allowed keywords for a given meta_type, or all
possible keywords if none supplied.
"""
- return self._listAllowedVocabulary( 'Subject', content )
+ return self.listAllowedVocabulary( 'Subject', content )
security.declarePublic( 'listAllowedFormats' )
def listAllowedFormats( self, content=None ):
@@ -537,14 +549,14 @@
List the allowed 'Content-type' values for a particular
meta_type, or all possible formats if none supplied.
"""
- return self._listAllowedVocabulary( 'Format', content )
+ return self.listAllowedVocabulary( 'Format', content )
security.declarePublic( 'listAllowedLanguages' )
def listAllowedLanguages( self, content=None ):
"""
List the allowed language values.
"""
- return self._listAllowedVocabulary( 'Language', content )
+ return self.listAllowedVocabulary( 'Language', content )
security.declarePublic( 'listAllowedRights' )
def listAllowedRights( self, content=None ):
@@ -553,7 +565,7 @@
selection list; this gets especially important where
syndication is involved.
"""
- return self._listAllowedVocabulary( 'Rights', content )
+ return self.listAllowedVocabulary( 'Rights', content )
security.declarePrivate( 'setInitialMetadata' )
def setInitialMetadata( self, content ):