| 1 | Manifest exporter and importer sections |
|---|
| 2 | ======================================= |
|---|
| 3 | |
|---|
| 4 | A manifest exporter and importer sections are used to generate and parse |
|---|
| 5 | manifest files - listings of objects contained in some folder in XML format. |
|---|
| 6 | These listings are needed to set portal types for pipeline items and also act |
|---|
| 7 | as filter on them - items not listed in manifest will be removed. Manifest |
|---|
| 8 | import section is also a source section - it will generate item for every |
|---|
| 9 | record seen in manifest which didn't have any corresponding item in the items |
|---|
| 10 | stream from previous source sections. The manifest exporter section blueprint name is |
|---|
| 11 | ``quintagroup.transmogrifier.manifestsexporter`` and importer section blueprint |
|---|
| 12 | name is ``quintagroup.transmogrifier.manifestimporter``. |
|---|
| 13 | |
|---|
| 14 | Both sections has ``files-key`` option that gives key in item where XML data |
|---|
| 15 | will be or is stored (default is ``_files``). Exporter section has |
|---|
| 16 | ``entries-key`` option, which specifies key in item where list of |
|---|
| 17 | (object_id, portal_type) pairs that represents folder contents is stored |
|---|
| 18 | (default is ``_entries``). Importer section has ``path-key`` option which |
|---|
| 19 | specifies key in item where path to object is stored (default is ``_path``) |
|---|
| 20 | and ``type-key`` option that gives key to store item's portal type (default is |
|---|
| 21 | ``_type``). |
|---|
| 22 | |
|---|
| 23 | >>> manifest = """ |
|---|
| 24 | ... [transmogrifier] |
|---|
| 25 | ... pipeline = |
|---|
| 26 | ... manifestsource |
|---|
| 27 | ... manifestexporter |
|---|
| 28 | ... manifestimporter |
|---|
| 29 | ... printer |
|---|
| 30 | ... dataprinter |
|---|
| 31 | ... |
|---|
| 32 | ... [manifestsource] |
|---|
| 33 | ... blueprint = quintagroup.transmogrifier.tests.manifestsource |
|---|
| 34 | ... |
|---|
| 35 | ... [manifestexporter] |
|---|
| 36 | ... blueprint = quintagroup.transmogrifier.manifestexporter |
|---|
| 37 | ... |
|---|
| 38 | ... [manifestimporter] |
|---|
| 39 | ... blueprint = quintagroup.transmogrifier.manifestimporter |
|---|
| 40 | ... |
|---|
| 41 | ... [printer] |
|---|
| 42 | ... blueprint = collective.transmogrifier.sections.tests.pprinter |
|---|
| 43 | ... |
|---|
| 44 | ... [dataprinter] |
|---|
| 45 | ... blueprint = quintagroup.transmogrifier.tests.dataprinter |
|---|
| 46 | ... print = |
|---|
| 47 | ... _files |
|---|
| 48 | ... manifest |
|---|
| 49 | ... data |
|---|
| 50 | ... """ |
|---|
| 51 | >>> registerConfig(u'quintagroup.transmogrifier.tests.manifest', |
|---|
| 52 | ... manifest) |
|---|
| 53 | >>> transmogrifier(u'quintagroup.transmogrifier.tests.manifest') # doctest: +ELLIPSIS, +REPORT_NDIFF |
|---|
| 54 | {'_entries': (('news', 'Folder'), |
|---|
| 55 | ('events', 'Folder'), |
|---|
| 56 | ('front-page', 'Document'), |
|---|
| 57 | ('only-in-manifest', 'Document')), |
|---|
| 58 | '_files': {'manifest': {'data': ... |
|---|
| 59 | 'name': '.objects.xml'}}, |
|---|
| 60 | '_path': ''} |
|---|
| 61 | <?xml version="1.0" ?> |
|---|
| 62 | <manifest> |
|---|
| 63 | <record type="Folder">news</record> |
|---|
| 64 | <record type="Folder">events</record> |
|---|
| 65 | <record type="Document">front-page</record> |
|---|
| 66 | <record type="Document">only-in-manifest</record> |
|---|
| 67 | </manifest> |
|---|
| 68 | <BLANKLINE> |
|---|
| 69 | {'_entries': (('aggregator', 'Topic'), ('once-more', 'File')), |
|---|
| 70 | '_files': {'manifest': {'data': ... |
|---|
| 71 | 'name': '.objects.xml'}}, |
|---|
| 72 | '_path': 'news', |
|---|
| 73 | '_type': 'Folder'} |
|---|
| 74 | <?xml version="1.0" ?> |
|---|
| 75 | <manifest> |
|---|
| 76 | <record type="Topic">aggregator</record> |
|---|
| 77 | <record type="File">once-more</record> |
|---|
| 78 | </manifest> |
|---|
| 79 | <BLANKLINE> |
|---|
| 80 | {'_type': 'Topic', '_path': 'news/aggregator'} |
|---|
| 81 | {'_type': 'Folder', '_path': 'events'} |
|---|
| 82 | {'_type': 'Document', '_path': 'front-page'} |
|---|
| 83 | {'_type': 'Document', '_path': 'only-in-manifest'} |
|---|
| 84 | {'_type': 'File', '_path': 'news/once-more'} |
|---|