Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
GenericSetup.registry.ExportStepRegistry Class Reference
Inheritance diagram for GenericSetup.registry.ExportStepRegistry:
Inheritance graph
[legend]
Collaboration diagram for GenericSetup.registry.ExportStepRegistry:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def registerStep
def listSteps
def getStepMetadata
def listStepMetadata
def generateXML
def getStep
def unregisterStep
def clear
def parseXML

Static Public Attributes

tuple security = ClassSecurityInfo()
 RegistryParser = _ExportStepRegistryParser

Static Private Attributes

tuple _exportTemplate = PageTemplateFile( 'esrExport.xml', _xmldir )

Detailed Description

Registry of known site-configuration export steps.

o Each step is registered with a unique id.

o When called, with the portal object passed in as an argument,
  the step must return a sequence of three-tuples,
  ( 'data', 'content_type', 'filename' ), one for each file exported
  by the step.

  - 'data' is a string containing the file data;

  - 'content_type' is the MIME type of the data;

  - 'filename' is a suggested filename for use when downloading.

Definition at line 458 of file registry.py.


Member Function Documentation

Definition at line 305 of file registry.py.

00305 
00306     def clear( self ):
00307 
00308         self._registered = {}

Here is the caller graph for this function:

Return a round-trippable XML representation of the registry.

o 'handler' values are serialized using their dotted names.

Definition at line 277 of file registry.py.

00277 
00278     def generateXML( self ):
00279 
00280         """ Return a round-trippable XML representation of the registry.
00281 
00282         o 'handler' values are serialized using their dotted names.
00283         """
00284         return self._exportTemplate()

def GenericSetup.registry.BaseStepRegistry.getStep (   self,
  key,
  default = None 
) [inherited]
Return the I(Export|Import)Plugin registered for 'key'.

o Return 'default' if no such step is registered.

Definition at line 286 of file registry.py.

00286 
00287     def getStep( self, key, default=None ):
00288 
00289         """ Return the I(Export|Import)Plugin registered for 'key'.
00290 
00291         o Return 'default' if no such step is registered.
00292         """
00293         marker = object()
00294         info = self._registered.get( key, marker )
00295 
00296         if info is marker:
00297             return default
00298 
00299         return _resolveDottedName( info[ 'handler' ] )

Here is the call graph for this function:

def GenericSetup.registry.BaseStepRegistry.getStepMetadata (   self,
  key,
  default = None 
) [inherited]
Return a mapping of metadata for the step identified by 'key'.

o Return 'default' if no such step is registered.

o The 'handler' metadata is available via 'getStep'.

Definition at line 245 of file registry.py.

00245 
00246     def getStepMetadata( self, key, default=None ):
00247 
00248         """ Return a mapping of metadata for the step identified by 'key'.
00249 
00250         o Return 'default' if no such step is registered.
00251 
00252         o The 'handler' metadata is available via 'getStep'.
00253         """
00254         result = {}
00255 
00256         info = self._registered.get( key )
00257 
00258         if info is None:
00259             return default
00260 
00261         result = info.copy()
00262         result['invalid'] =  _resolveDottedName( result[ 'handler' ] ) is None
00263 
00264         return result

Here is the call graph for this function:

Here is the caller graph for this function:

Return a sequence of mappings describing registered steps.

o Mappings will be ordered alphabetically.

Definition at line 266 of file registry.py.

00266 
00267     def listStepMetadata( self ):
00268 
00269         """ Return a sequence of mappings describing registered steps.
00270 
00271         o Mappings will be ordered alphabetically.
00272         """
00273         step_ids = self.listSteps()
00274         step_ids.sort()
00275         return [ self.getStepMetadata( x ) for x in step_ids ]

Here is the call graph for this function:

Return a list of registered step IDs.

Definition at line 238 of file registry.py.

00238 
00239     def listSteps( self ):
00240 
00241         """ Return a list of registered step IDs.
00242         """
00243         return self._registered.keys()

Here is the caller graph for this function:

def GenericSetup.registry.BaseStepRegistry.parseXML (   self,
  text,
  encoding = None 
) [inherited]
Parse 'text'.

Definition at line 310 of file registry.py.

00310 
00311     def parseXML( self, text, encoding=None ):
00312 
00313         """ Parse 'text'.
00314         """
00315         reader = getattr( text, 'read', None )
00316 
00317         if reader is not None:
00318             text = reader()
00319 
00320         parser = self.RegistryParser( encoding )
00321         parseString( text, parser )
00322 
00323         return parser._parsed
00324 InitializeClass( BaseStepRegistry )

Here is the caller graph for this function:

def GenericSetup.registry.ExportStepRegistry.registerStep (   self,
  id,
  handler,
  title = None,
  description = None 
)
Register an export step.

o 'id' is the unique identifier for this step

o 'handler' is the dottoed name of a handler which should implement
   IImportPlugin.

o 'title' is a one-line UI description for this step.
  If None, the first line of the documentation string of the step
  is used, or the id if no docstring can be found.

o 'description' is a one-line UI description for this step.
  If None, the remaining line of the documentation string of
  the step is used, or default to ''.

Definition at line 482 of file registry.py.

00482 
00483     def registerStep( self, id, handler, title=None, description=None ):
00484 
00485         """ Register an export step.
00486 
00487         o 'id' is the unique identifier for this step
00488 
00489         o 'handler' is the dottoed name of a handler which should implement
00490            IImportPlugin.
00491 
00492         o 'title' is a one-line UI description for this step.
00493           If None, the first line of the documentation string of the step
00494           is used, or the id if no docstring can be found.
00495 
00496         o 'description' is a one-line UI description for this step.
00497           If None, the remaining line of the documentation string of
00498           the step is used, or default to ''.
00499         """
00500         if not isinstance(handler, str):
00501             handler = _getDottedName( handler )
00502 
00503         if title is None or description is None:
00504 
00505             method = _resolveDottedName(handler)
00506             if method is None:
00507                 t,d = id, ''
00508             else:
00509                 t, d = _extractDocstring( method, id, '' )
00510 
00511             title = title or t
00512             description = description or d
00513 
00514         info = { 'id'           : id
00515                , 'handler'      : handler
00516                , 'title'        : title
00517                , 'description'  : description
00518                }
00519 
00520         self._registered[ id ] = info
00521 

Here is the call graph for this function:

def GenericSetup.registry.BaseStepRegistry.unregisterStep (   self,
  id 
) [inherited]

Definition at line 301 of file registry.py.

00301 
00302     def unregisterStep( self, id ):
00303         del self._registered[id]


Member Data Documentation

tuple GenericSetup.registry.ExportStepRegistry._exportTemplate = PageTemplateFile( 'esrExport.xml', _xmldir ) [static, private]

Definition at line 526 of file registry.py.

Definition at line 479 of file registry.py.

tuple GenericSetup.registry.ExportStepRegistry.security = ClassSecurityInfo() [static]

Reimplemented from GenericSetup.registry.BaseStepRegistry.

Definition at line 478 of file registry.py.


The documentation for this class was generated from the following file: