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

Last change on this file since 1589 was 371, checked in by piv, 18 years ago

replace pngs

File size: 2.7 KB
Line 
1Comments exporter and importer sections
2=======================================
3
4Comments exporter and importer sections are used to migrate comments for site
5content. The comments exporter section blueprint name is
6``quintagroup.transmogrifier.commentsexporter`` and importer section blueprint
7name is ``quintagroup.transmogrifier.commentsimporter``.
8
9Comments are represented in XML format. Both sections need relative path to the
10object with comments and importer also needs XML data for adding comments.
11
12Both sections has ``path-key`` option which specify key in item where path to
13object is stored (``_path`` is default) and ``files-key`` option that gives
14key where XML data will be or is stored.
15
16>>> import pprint
17>>> comments = """
18... [transmogrifier]
19... pipeline =
20...     commentssource
21...     commentsexporter
22...     printer
23...     dataprinter
24...     commentsimporter
25...     
26... [commentssource]
27... blueprint = quintagroup.transmogrifier.tests.commentssource
28...
29... [commentsexporter]
30... blueprint = quintagroup.transmogrifier.commentsexporter
31...
32... [printer]
33... blueprint = collective.transmogrifier.sections.tests.pprinter
34...
35... [dataprinter]
36... blueprint = quintagroup.transmogrifier.tests.dataprinter
37... print =
38...     _files
39...     comments
40...     data
41...
42... [commentsimporter]
43... blueprint = quintagroup.transmogrifier.commentsimporter
44... """
45>>> registerConfig(u'quintagroup.transmogrifier.tests.comments', comments)
46>>> transmogrifier(u'quintagroup.transmogrifier.tests.comments') # doctest: +ELLIPSIS, +REPORT_NDIFF
47{}
48{'_path': 'not/existing/bar'}
49{'_path': 'spam/eggs/notdiscussable'}
50{'_files': {'comments': {'data': ...
51                         'name': '.comments.xml'}},
52 '_path': 'spam/eggs/foo'}
53...
54<discussion>
55  <item id="1">
56    <field name="Creator">
57      creator
58    </field>
59    <field name="Modification_date">
60      date
61    </field>
62    <field name="In_reply_to">
63      None
64    </field>
65    <field name="Text">
66      comment to content
67    </field>
68  </item>
69  <item id="2">
70    <field name="Creator">
71      creator
72    </field>
73    <field name="Modification_date">
74      date
75    </field>
76    <field name="In_reply_to">
77      1
78    </field>
79    <field name="Text">
80      reply to first comment
81    </field>
82  </item>
83  <item id="3">
84    <field name="Creator">
85      creator
86    </field>
87    <field name="Modification_date">
88      date
89    </field>
90    <field name="In_reply_to">
91      None
92    </field>
93    <field name="Text">
94      other comment to content
95    </field>
96  </item>
97</discussion>
98<BLANKLINE>
99>>> pprint.pprint(plone._container)
100{'1': <DicussionItem creator date None comment to content>,
101 '2': <DicussionItem creator date 1 reply to first comment>,
102 '3': <DicussionItem creator date None other comment to content>}
Note: See TracBrowser for help on using the repository browser.