[275] | 1 | Marshall section |
---|
| 2 | ================ |
---|
| 3 | |
---|
| 4 | The marshall section blueprint name is |
---|
| 5 | ``quintagroup.transmogrifier.marshall``. |
---|
| 6 | |
---|
| 7 | Marshall needs at least 1 piece of information: the path to the object |
---|
| 8 | to update. To determine the path, the marshall section inspects each |
---|
| 9 | item and looks for one key, as described below. Any item missing this piece of |
---|
| 10 | information will be skipped. Similarly, items with a path that doesn't exist |
---|
| 11 | or are not Archetypes objects will be skipped as well. |
---|
| 12 | |
---|
| 13 | For the object path, it'll look (in order) for |
---|
| 14 | ``_plone.app.transmogrifier.atschemaupdater_[sectionname]_path``, |
---|
| 15 | ``_plone.app.transmogrifier.atschemaupdater_path``, ``_[sectionname]_path`` |
---|
| 16 | and ``_path``, where ``[sectionname]`` is replaced with the name given to the |
---|
| 17 | current section. This allows you to target the right section precisely if |
---|
| 18 | needed. Alternatively, you can specify what key to use for the path by |
---|
| 19 | specifying the ``path-key`` option, which should be a list of keys to try (one |
---|
| 20 | key per line, use a ``re:`` or ``regexp:`` prefix to specify regular |
---|
| 21 | expressions). |
---|
| 22 | |
---|
| 23 | Paths to objects are always interpreted as relative to the context. |
---|
| 24 | |
---|
| 25 | >>> import pprint |
---|
| 26 | >>> marshall = """ |
---|
| 27 | ... [transmogrifier] |
---|
| 28 | ... pipeline = |
---|
| 29 | ... marshallsource |
---|
| 30 | ... marshall |
---|
| 31 | ... printer |
---|
| 32 | ... |
---|
| 33 | ... [marshallsource] |
---|
| 34 | ... blueprint = quintagroup.transmogrifier.tests.marshallsource |
---|
| 35 | ... |
---|
| 36 | ... [marshall] |
---|
| 37 | ... blueprint = quintagroup.transmogrifier.marshall |
---|
| 38 | ... |
---|
| 39 | ... [printer] |
---|
| 40 | ... blueprint = collective.transmogrifier.sections.tests.pprinter |
---|
| 41 | ... """ |
---|
| 42 | >>> registerConfig(u'quintagroup.transmogrifier.tests.marshall', marshall) |
---|
| 43 | >>> transmogrifier(u'quintagroup.transmogrifier.tests.marshall') # doctest: +REPORT_NDIFF |
---|
| 44 | {'_excluded_fields': ('fieldone', 'fieldtwo'), |
---|
| 45 | '_files': {'marshall': {'data': 'marshalled', 'name': '.marshall.xml'}}, |
---|
| 46 | '_path': 'spam/eggs/foo'} |
---|
| 47 | {'_files': {'marshall': {'data': None, 'name': '.marshall.xml'}}, |
---|
| 48 | '_path': 'topic/criterion'} |
---|
| 49 | {'_path': 'not/existing/bar'} |
---|
| 50 | {} |
---|
| 51 | {'_path': 'spam/eggs/notatcontent'} |
---|
| 52 | >>> pprint.pprint(plone.exported) |
---|
| 53 | (('spam/eggs/foo', ('fieldone', 'fieldtwo')), ('topic/criterion', ())) |
---|