Back to index

plone3  3.1.7
Classes | Functions | Variables
CMFActionIcons.exportimport Namespace Reference

Classes

class  ActionIconsToolExportConfigurator
class  ActionIconsToolImportConfigurator

Functions

def importActionIconsTool
def exportActionIconsTool

Variables

tuple _pkgdir = package_home( globals() )
tuple _xmldir = os.path.join( _pkgdir, 'xml' )
string _FILENAME = 'actionicons.xml'

Function Documentation

Export caching policy manager settings as an XML file.

Definition at line 77 of file exportimport.py.

00077 
00078 def exportActionIconsTool(context):
00079     """ Export caching policy manager settings as an XML file.
00080     """
00081     site = context.getSite()
00082     mhc = ActionIconsToolExportConfigurator( site ).__of__( site )
00083     text = mhc.generateXML()
00084 
00085     context.writeDataFile( _FILENAME, text, 'text/xml' )
00086 
00087     return 'Action icons tool settings exported.'
00088 

Here is the caller graph for this function:

Import action icons tool settings from an XML file.

Definition at line 44 of file exportimport.py.

00044 
00045 def importActionIconsTool(context):
00046     """ Import action icons tool settings from an XML file.
00047     """
00048     site = context.getSite()
00049     sm = getSiteManager(site)
00050     ait = sm.queryUtility(IActionIconsTool)
00051     if ait is None:
00052         return 'Action icons: No tool!'
00053 
00054     body = context.readDataFile(_FILENAME)
00055     if body is None:
00056         return 'Action icons: Nothing to import.'
00057 
00058     if context.shouldPurge():
00059         ait.clearActionIcons()
00060 
00061     # now act on the settings we've retrieved
00062     configurator = ActionIconsToolImportConfigurator(site)
00063     ait_info = configurator.parseXML(body)
00064 
00065     for action_icon in ait_info['action_icons']:
00066         category = action_icon['category']
00067         action_id = action_icon['action_id']
00068         # Ignore the i18n markup
00069         if action_icon.get('i18n:attributes', None) is not None:
00070             del action_icon['i18n:attributes']
00071         if ait.queryActionInfo(category, action_id) is not None:
00072             ait.updateActionIcon(**action_icon)
00073         else:
00074             ait.addActionIcon(**action_icon)
00075 
00076     return 'Action icons settings imported.'

Here is the caller graph for this function:


Variable Documentation

string CMFActionIcons.exportimport._FILENAME = 'actionicons.xml'

Definition at line 42 of file exportimport.py.

tuple CMFActionIcons.exportimport._pkgdir = package_home( globals() )

Definition at line 36 of file exportimport.py.

tuple CMFActionIcons.exportimport._xmldir = os.path.join( _pkgdir, 'xml' )

Definition at line 37 of file exportimport.py.