1 | Data corrector section |
---|
2 | ====================== |
---|
3 | |
---|
4 | A data corrector section lets you use context sensitive components (adapters) |
---|
5 | to do needed corrections in data generated in previous sections. The data |
---|
6 | corrector section blueprint name is ``quintagroup.transmogrifier.datacorrector``. |
---|
7 | |
---|
8 | Data corrector needs next information: the path to the object (context), the |
---|
9 | key in item on which is stored contaired with data from previous sections and |
---|
10 | sources - list of keys in this container which points to data, that need to |
---|
11 | be corrected. Every key in this list is also a name of adapter to lookup. |
---|
12 | |
---|
13 | Adapter are of two types: ``export`` and ``import``. What to use is controlled |
---|
14 | by ``type`` option, ``export`` is default value. |
---|
15 | |
---|
16 | Paths 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'} |
---|