[283] | 1 | Manifest exporter and importer sections |
---|
| 2 | ======================================= |
---|
[275] | 3 | |
---|
[283] | 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 |
---|
[430] | 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 |
---|
[283] | 11 | ``quintagroup.transmogrifier.manifestsexporter`` and importer section blueprint |
---|
| 12 | name is ``quintagroup.transmogrifier.manifestimporter``. |
---|
[282] | 13 | |
---|
[283] | 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 |
---|
[430] | 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``). |
---|
[283] | 22 | |
---|
[275] | 23 | >>> manifest = """ |
---|
| 24 | ... [transmogrifier] |
---|
| 25 | ... pipeline = |
---|
| 26 | ... manifestsource |
---|
[283] | 27 | ... manifestexporter |
---|
| 28 | ... manifestimporter |
---|
[275] | 29 | ... printer |
---|
[283] | 30 | ... dataprinter |
---|
[275] | 31 | ... |
---|
| 32 | ... [manifestsource] |
---|
| 33 | ... blueprint = quintagroup.transmogrifier.tests.manifestsource |
---|
| 34 | ... |
---|
[283] | 35 | ... [manifestexporter] |
---|
| 36 | ... blueprint = quintagroup.transmogrifier.manifestexporter |
---|
[275] | 37 | ... |
---|
[283] | 38 | ... [manifestimporter] |
---|
| 39 | ... blueprint = quintagroup.transmogrifier.manifestimporter |
---|
| 40 | ... |
---|
[275] | 41 | ... [printer] |
---|
| 42 | ... blueprint = collective.transmogrifier.sections.tests.pprinter |
---|
[283] | 43 | ... |
---|
| 44 | ... [dataprinter] |
---|
| 45 | ... blueprint = quintagroup.transmogrifier.tests.dataprinter |
---|
| 46 | ... print = |
---|
| 47 | ... _files |
---|
| 48 | ... manifest |
---|
| 49 | ... data |
---|
[275] | 50 | ... """ |
---|
| 51 | >>> registerConfig(u'quintagroup.transmogrifier.tests.manifest', |
---|
| 52 | ... manifest) |
---|
[283] | 53 | >>> transmogrifier(u'quintagroup.transmogrifier.tests.manifest') # doctest: +ELLIPSIS, +REPORT_NDIFF |
---|
| 54 | {'_entries': (('news', 'Folder'), |
---|
| 55 | ('events', 'Folder'), |
---|
[430] | 56 | ('front-page', 'Document'), |
---|
| 57 | ('only-in-manifest', 'Document')), |
---|
[275] | 58 | '_files': {'manifest': {'data': ... |
---|
[283] | 59 | 'name': '.objects.xml'}}, |
---|
| 60 | '_path': ''} |
---|
[275] | 61 | <?xml version="1.0" ?> |
---|
| 62 | <manifest> |
---|
[283] | 63 | <record type="Folder">news</record> |
---|
| 64 | <record type="Folder">events</record> |
---|
| 65 | <record type="Document">front-page</record> |
---|
[430] | 66 | <record type="Document">only-in-manifest</record> |
---|
[275] | 67 | </manifest> |
---|
| 68 | <BLANKLINE> |
---|
[430] | 69 | {'_entries': (('aggregator', 'Topic'), ('once-more', 'File')), |
---|
[283] | 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> |
---|
[430] | 77 | <record type="File">once-more</record> |
---|
[283] | 78 | </manifest> |
---|
| 79 | <BLANKLINE> |
---|
| 80 | {'_type': 'Topic', '_path': 'news/aggregator'} |
---|
| 81 | {'_type': 'Folder', '_path': 'events'} |
---|
| 82 | {'_type': 'Document', '_path': 'front-page'} |
---|
[430] | 83 | {'_type': 'Document', '_path': 'only-in-manifest'} |
---|
| 84 | {'_type': 'File', '_path': 'news/once-more'} |
---|