source: products/quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier/quintagroup/transmogrifier/datacorrector.txt @ 1413

Last change on this file since 1413 was 277, checked in by mylan, 18 years ago

Fix publishing bug

File size: 2.0 KB
Line 
1Data corrector section
2======================
3
4A data corrector section lets you use context sensitive components (adapters)
5to do needed corrections in data generated in previous sections. The data
6corrector section blueprint name is ``quintagroup.transmogrifier.datacorrector``.
7
8Data corrector needs next information: the path to the object (context), the
9key in item on which is stored contaired with data from previous sections and
10sources -  list of keys in this container which points to data, that need to
11be corrected. Every key in this list is also a name of adapter to lookup.
12
13Adapter are of two types: ``export`` and ``import``. What to use is controlled
14by ``type`` option, ``export`` is default value.
15
16Paths to objects are always interpreted as relative to the context.
17
18>>> datacorrector = """
19... [transmogrifier]
20... pipeline =
21...     source
22...     exportcorrector
23...     importcorrector
24...     printer
25...     
26... [source]
27... blueprint = quintagroup.transmogrifier.tests.datacorrectorsource
28...
29... [exportcorrector]
30... blueprint = quintagroup.transmogrifier.datacorrector
31... sources = marshall
32...
33... [importcorrector]
34... blueprint = quintagroup.transmogrifier.datacorrector
35... type = import
36... sources =
37...     manifest
38...     unchanged
39...     nodata
40...
41... [printer]
42... blueprint = collective.transmogrifier.sections.tests.pprinter
43...
44... """
45>>> registerConfig(u'quintagroup.transmogrifier.tests.datacorrector', datacorrector)
46>>> transmogrifier(u'quintagroup.transmogrifier.tests.datacorrector') # doctest: +ELLIPSIS, +REPORT_NDIFF
47{}
48{'_files': {'marshall': "item hasn't path"}}
49{'_path': 'spam/eggs/foo'}
50{'_path': 'not/existing/bar'}
51{'_files': {'marshall': "object isn't adaptable"},
52 '_path': 'spam/eggs/notadaptable'}
53{'_files': {'marshall': 'modified export data',
54            'unchanged': 'this must be unchanged'},
55 '_path': 'spam/eggs/foo'}
56{'_files': {'manifest': 'modified import data',
57            'unchanged': 'this must be unchanged'},
58 '_path': 'spam/eggs/foo'}
Note: See TracBrowser for help on using the repository browser.