Back to index

plone3  3.1.7
Classes | Functions
plone.app.contentrules.exportimport.rules Namespace Reference

Classes

class  PropertyRuleElementExportImportHandler
class  RulesXMLAdapter

Functions

def as_bool
def importRules
def exportRules

Function Documentation

def plone.app.contentrules.exportimport.rules.as_bool (   string,
  default = False 
)

Definition at line 39 of file rules.py.

00039 
00040 def as_bool(string, default=False):
00041     if string is None or not str(string):
00042         return default
00043     return string.lower() == 'true'
00044     

Here is the caller graph for this function:

Export content rules

Definition at line 426 of file rules.py.

00426 
00427 def exportRules(context):
00428     """Export content rules
00429     """
00430     site = context.getSite()
00431     exporter = queryMultiAdapter((site, context), IBody, name=u'plone.contentrules')
00432     if exporter is not None:
00433         filename = '%s%s' % (exporter.name, exporter.suffix)
00434         body = exporter.body
00435         if body is not None:
00436             context.writeDataFile(filename, body, exporter.mime_type)
Import content rules

Definition at line 413 of file rules.py.

00413 
00414 def importRules(context):
00415     """Import content rules
00416     """
00417     site = context.getSite()
00418     importer = queryMultiAdapter((site, context), IBody, name=u'plone.contentrules')
00419     if importer is not None:
00420         filename = '%s%s' % (importer.name, importer.suffix)
00421         body = context.readDataFile(filename)
00422         if body is not None:
00423             importer.filename = filename # for error reporting
00424             importer.body = body
00425