[CMF-checkins] CVS: CMF/CMFSetup - typeinfo.py:1.2
Tres Seaver
tseaver at zope.com
Sat May 29 19:45:25 EDT 2004
Update of /cvs-repository/CMF/CMFSetup
In directory cvs.zope.org:/tmp/cvs-serv3407
Modified Files:
typeinfo.py
Log Message:
- Split out dumped configuration of the tool from each type info, in
preparation for splitting them out into separate files.
=== CMF/CMFSetup/typeinfo.py 1.1 => 1.2 ===
--- CMF/CMFSetup/typeinfo.py:1.1 Thu May 27 00:23:50 2004
+++ CMF/CMFSetup/typeinfo.py Sat May 29 19:44:53 2004
@@ -26,6 +26,23 @@
self._site = site
+ security.declareProtected( ManagePortal, 'getTypeInfo' )
+ def getTypeInfo( self, type_id ):
+
+ """ Return a mapping for the given type info in the site.
+
+ o These mappings are pretty much equivalent to the stock
+ 'factory_type_information' elements used everywhere in the
+ CMF.
+ """
+ typestool = getToolByName( self._site, 'portal_types' )
+ try:
+ ti = typestool.getTypeInfo( type_id )
+ except KeyError:
+ raise ValueError, 'Unknown type: %s' % type_id
+ else:
+ return self._makeTIMapping( ti )
+
security.declareProtected( ManagePortal, 'listTypeInfo' )
def listTypeInfo( self ):
@@ -46,22 +63,34 @@
return result
+ security.declareProtected( ManagePortal, 'generateToolXML' )
+ def generateToolXML( self ):
+
+ """ Pseudo API.
+ """
+ return self._toolConfig()
- security.declareProtected(ManagePortal, 'generateXML' )
- def generateXML(self):
+ security.declareProtected( ManagePortal, 'generateTypeXML' )
+ def generateTypeXML( self, type_id ):
""" Pseudo API.
"""
- return self._typeinfoConfig()
+ return self._typeConfig( type_id=type_id )
#
# Helper methods
#
- security.declarePrivate( '_typeinfoConfig' )
- _typeinfoConfig = PageTemplateFile( 'ticExport.xml'
- , _xmldir
- , __name__='typeinfoConfig'
- )
+ security.declarePrivate( '_toolConfig' )
+ _toolConfig = PageTemplateFile( 'ticToolExport.xml'
+ , _xmldir
+ , __name__='toolConfig'
+ )
+
+ security.declarePrivate( '_typeConfig' )
+ _typeConfig = PageTemplateFile( 'ticTypeExport.xml'
+ , _xmldir
+ , __name__='typeConfig'
+ )
security.declarePrivate( '_makeTIMapping' )
def _makeTIMapping( self, ti ):
More information about the CMF-checkins
mailing list