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 | ... enable-source-behaviour = true |
---|
41 | ... |
---|
42 | ... [printer] |
---|
43 | ... blueprint = collective.transmogrifier.sections.tests.pprinter |
---|
44 | ... |
---|
45 | ... [dataprinter] |
---|
46 | ... blueprint = quintagroup.transmogrifier.tests.dataprinter |
---|
47 | ... print = |
---|
48 | ... _files |
---|
49 | ... manifest |
---|
50 | ... data |
---|
51 | ... """ |
---|
52 | >>> registerConfig(u'quintagroup.transmogrifier.tests.manifest', |
---|
53 | ... manifest) |
---|
54 | >>> transmogrifier(u'quintagroup.transmogrifier.tests.manifest') # doctest: +ELLIPSIS, +REPORT_NDIFF |
---|
55 | {'_entries': (('news', 'Folder'), |
---|
56 | ('events', 'Folder'), |
---|
57 | ('front-page', 'Document'), |
---|
58 | ('only-in-manifest', 'Document')), |
---|
59 | '_files': {'manifest': {'data': ... |
---|
60 | 'name': '.objects.xml'}}, |
---|
61 | '_path': ''} |
---|
62 | <?xml version="1.0" encoding="utf-8"?> |
---|
63 | <manifest> |
---|
64 | <record type="Folder"> |
---|
65 | news |
---|
66 | </record> |
---|
67 | <record type="Folder"> |
---|
68 | events |
---|
69 | </record> |
---|
70 | <record type="Document"> |
---|
71 | front-page |
---|
72 | </record> |
---|
73 | <record type="Document"> |
---|
74 | only-in-manifest |
---|
75 | </record> |
---|
76 | </manifest> |
---|
77 | <BLANKLINE> |
---|
78 | {'_entries': (('aggregator', 'Topic'), ('once-more', 'File')), |
---|
79 | '_files': {'manifest': {'data': ... |
---|
80 | 'name': '.objects.xml'}}, |
---|
81 | '_path': 'news', |
---|
82 | '_type': 'Folder'} |
---|
83 | <?xml version="1.0" encoding="utf-8"?> |
---|
84 | <manifest> |
---|
85 | <record type="Topic"> |
---|
86 | aggregator |
---|
87 | </record> |
---|
88 | <record type="File"> |
---|
89 | once-more |
---|
90 | </record> |
---|
91 | </manifest> |
---|
92 | <BLANKLINE> |
---|
93 | {'_type': 'Topic', '_path': 'news/aggregator'} |
---|
94 | {'_type': 'Folder', '_path': 'events'} |
---|
95 | {'_type': 'Document', '_path': 'front-page'} |
---|
96 | {'_type': 'Document', '_path': 'only-in-manifest'} |
---|
97 | {'_type': 'File', '_path': 'news/once-more'} |
---|