source: products/quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/interfacemanager.txt @ 1478

Last change on this file since 1478 was 1478, checked in by mylan, 14 years ago

Added tests for importmanager section

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1Interfaces exporter and importer sections
2=========================================
3
4Interfaces exporter and importer sections are used to migrate interfaces for
5objects.
6The interfaces exporter section blueprint name is
7``quintagroup.transmogrifier.interfacesexporter`` and importer section blueprint
8name is ``quintagroup.transmogrifier.interfacesimporter``.
9
10Interfaces are represented in XML format. Both sections need relative
11path to the object with interfaces and importer also needs XML data for updating
12interfaces provided by object.
13
14Both sections has ``path-key`` option which specifies key in item where path to
15object is stored (``_path`` is default) and ``files-key`` option that gives
16key where XML data will be or is stored. Also there are ``include`` and
17``exclude`` options that give global list of interface identifiers to include or
18exclude on serializing. There are correspondent ``include-key``, ``exclude-key``
19options, that specifies key where same lists per item is stored (default is
20``_included_interfaces`` & ``_excluded_interfaces``). These options give you
21alternative way to manage interfaces to serialize and apply to the object.
22``include`` option - include only interfaces, listed in, and ``exclude`` option
23behave in opposite way. If both options present - only ``include`` option get
24into consideration. If both options is absent - all interfaces will be
25serialized and/or migrated.
26
27
28>>> import pprint
29>>> interfacemanager = """
30... [transmogrifier]
31... pipeline =
32...     interfacemanagersource
33...     interfacesexporter
34...     printer
35...     dataprinter
36...     interfacesimporter
37...     
38... [interfacemanagersource]
39... blueprint = quintagroup.transmogrifier.tests.interfacemanagersource
40...
41... [interfacesexporter]
42... blueprint = quintagroup.transmogrifier.interfacesexporter
43...
44... [printer]
45... blueprint = collective.transmogrifier.sections.tests.pprinter
46...
47... [dataprinter]
48... blueprint = quintagroup.transmogrifier.tests.dataprinter
49... print =
50...     _files
51...     interfaces
52...     data
53...
54... [interfacesimporter]
55... blueprint = quintagroup.transmogrifier.interfacesimporter
56... include =
57...     zope.annotation.interfaces.IAttributeAnnotatable
58... """
59>>> registerConfig(u'quintagroup.transmogrifier.tests.interfacemanager', interfacemanager)
60>>> transmogrifier(u'quintagroup.transmogrifier.tests.interfacemanager') # doctest: +ELLIPSIS, +REPORT_NDIFF
61{}
62{'_path': 'not/existing/bar'}
63{'_path': 'spam/eggs/notatcontent'}
64{'_files': {'interfaces': {'data': ...
65                           'name': '.interfaces.xml'}},
66 '_path': 'spam/eggs/foo'}
67<?xml version="1.0" encoding="utf-8"?>
68<interfaces>
69  <record>
70    zope.annotation.interfaces.IAttributeAnnotatable
71  </record>
72  <record>
73    Products.Archetypes.interfaces._base.IBaseObject
74  </record>
75</interfaces>
76<BLANKLINE>
77
78>>> pprint.pprint(updated)
79['zope.annotation.interfaces.IAttributeAnnotatable']
Note: See TracBrowser for help on using the repository browser.