Comments exporter and importer sections
=======================================

Comments exporter and importer sections are used to migrate comments for site
content. The comments exporter section blueprint name is
``quintagroup.transmogrifier.commentsexporter`` and importer section blueprint
name is ``quintagroup.transmogrifier.commentsimporter``.

Comments are represented in XML format. Both sections need relative path to the
object with comments and importer also needs XML data for adding comments.

Both sections has ``path-key`` option which specify key in item where path to
object is stored (``_path`` is default) and ``files-key`` option that gives
key where XML data will be or is stored.

>>> import pprint
>>> comments = """
... [transmogrifier]
... pipeline =
...     commentssource
...     commentsexporter
...     printer
...     dataprinter
...     commentsimporter
...     
... [commentssource]
... blueprint = quintagroup.transmogrifier.tests.commentssource
... 
... [commentsexporter]
... blueprint = quintagroup.transmogrifier.commentsexporter
... 
... [printer]
... blueprint = collective.transmogrifier.sections.tests.pprinter
... 
... [dataprinter]
... blueprint = quintagroup.transmogrifier.tests.dataprinter
... print = 
...     _files
...     comments
...     data
... 
... [commentsimporter]
... blueprint = quintagroup.transmogrifier.commentsimporter
... """
>>> registerConfig(u'quintagroup.transmogrifier.tests.comments', comments)
>>> transmogrifier(u'quintagroup.transmogrifier.tests.comments') # doctest: +ELLIPSIS, +REPORT_NDIFF
[]
[('_path', 'not/existing/bar')]
[('_path', 'spam/eggs/notdiscussable')]
[('_files',
  [('comments',
    [('data',
      '<?xml...>\n'),
     ('name', '.comments.xml')])]),
 ('_path', 'spam/eggs/foo')]
<?xml version="1.0" encoding="utf-8"?>
<discussion>
  <item id="1">
    <field name="Creator">creator</field>
    <field name="Modification_date">date</field>
    <field name="In_reply_to">None</field>
    <field name="Text">comment to content</field>
  </item>
  <item id="2">
    <field name="Creator">creator</field>
    <field name="Modification_date">date</field>
    <field name="In_reply_to">1</field>
    <field name="Text">reply to first comment</field>
  </item>
  <item id="3">
    <field name="Creator">creator</field>
    <field name="Modification_date">date</field>
    <field name="In_reply_to">None</field>
    <field name="Text">other comment to content</field>
  </item>
</discussion>
<BLANKLINE>

>>> pprint.pprint(plone._container)
{'1': <DicussionItem creator date None comment to content>,
 '2': <DicussionItem creator date 1 reply to first comment>,
 '3': <DicussionItem creator date None other comment to content>}
