source: products/quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/substitution.txt @ 1589

Last change on this file since 1589 was 275, checked in by mylan, 18 years ago

Removed file/folder

File size: 1.2 KB
Line 
1Substitution section
2====================
3
4A substitution pipeline section lets you substitute item's value stored
5on some key with value given in options. The substitution section blueprint
6name is ``quintagroup.transmogrifier.substitution``.
7
8Substition is performed in this way: if section has option with name that
9is equal to value stored on this key, than value of this option is used
10as new value for this key. Old value is stored on ``_old${key}`` key.
11Which key to use is determined by ``key`` option.
12
13>>> substitution = """
14... [transmogrifier]
15... pipeline =
16...     source
17...     substitution
18...     printer
19...
20... [source]
21... blueprint = quintagroup.transmogrifier.tests.substitutionsource
22...
23... [substitution]
24... blueprint = quintagroup.transmogrifier.substitution
25... key = _type
26... Blog = Weblog
27... PloneFormMailer = FormFolder
28...
29... [printer]
30... blueprint = collective.transmogrifier.sections.tests.pprinter
31... """
32>>> registerConfig(u'quintagroup.transmogrifier.tests.substitution', substitution)
33>>> transmogrifier(u'quintagroup.transmogrifier.tests.substitution') # doctest: +ELLIPSIS, +REPORT_NDIFF
34{}
35{'_old_type': 'Blog', '_type': 'Weblog'}
36{'_old_type': 'PloneFormMailer', '_type': 'FormFolder'}
37{'_type': 'Document'}
Note: See TracBrowser for help on using the repository browser.