Products.csvreplicata

HomePage: https://svn.plone.org/svn/collective/Products.csvreplicata

Author: Eric BREHAULT

Download: https://pypi.python.org/packages/source/P/Products.csvreplicata/Products.csvreplicata-1.1.13.zip

        Introduction
============

Allows to export and import AT objects contents and hierarchy.

It supports also other contents or objects via plugins (ZCA).
This part  mainly targeted for a developper audiance, so see interfaces.py / adapters.py.


We have plans to integrate the export/import code with transmogrifier_, [ also_ ] but we have no ETA For now.

.. _transmogrifier: http://pypi.python.org/pypi/collective.transmogrifier/
.. _also: http://pypi.python.org/pypi/plone.app.transmogrifier/


Repository: git_


.. _git: https://github.com/collective/Products.csvreplicata.git

A Makina Corpus add-on
-------------------------
|makinacom|_

* `Planet Makina Corpus <http://www.makina-corpus.org>`_
* `Contact us <mailto:python@makina-corpus.org>`_

.. |makinacom| image:: http://depot.makina-corpus.org/public/logo.gif
.. _makinacom:  http://www.makina-corpus.com


Products.csvreplicata Installation
======================================

To install Products.csvreplicata into the global Python environment (or a workingenv),
using a traditional Zope 2 instance, you can do this:

 * When you're reading this you have probably already run
   ``easy_install Products.csvreplicata``. Find out how to install setuptools
   (and EasyInstall) here:
   http://peak.telecommunity.com/DevCenter/EasyInstall

 * If you are using Zope 2.9 (not 2.10), get `pythonproducts`_ and install it
   via::

       python setup.py install --home /path/to/instance

   into your Zope instance.

 * Create a file called ``Products.csvreplicata-configure.zcml`` in the
   ``/path/to/instance/etc/package-includes`` directory.  The file
   should only contain this::

       <include package="Products.csvreplicata" />

.. _pythonproducts: http://plone.org/products/pythonproducts


Alternatively, if you are using zc.buildout and the plone.recipe.zope2instance
recipe to manage your project, you can do this:

 * Add ``Products.csvreplicata`` to the list of eggs to install, e.g.

::

    [buildout]
    ...
    eggs =
        ...
        Products.csvreplicata

  * Tell the plone.recipe.zope2instance recipe to install a ZCML slug

::

    [instance]
    recipe = plone.recipe.zope2instance
    ...
    zcml =
        Products.csvreplicata

  * Re-run buildout, e.g. with:

    $ ./bin/buildout

You can skip the ZCML slug if you are going to explicitly include the package
from another package's configure.zcml file.


Because its top level Python namespace package is called ``Products``, this
package can also be installed in Zope 2 as an old style **Zope 2 Product**.

For that, move (or symlink) the ``csvreplicata`` folder of this project
(``Products.csvreplicata/Products/csvreplicata``) into the ``Products`` directory of
the Zope instance it has to be installed for, and restart the server.

You can also skip the ZCML slug if you install this package the **Zope 2
Product** way.

Detailled documentation
=======================


Interfaces
-------------
import interfaces and classes ::

    >>> from zope.interface.verify import verifyClass
    >>> from zope.interface import implements
    >>> from Products.csvreplicata.handlers.base import CSVdefault
    >>> from Products.csvreplicata.handlers.file import CSVFile
    >>> from Products.csvreplicata.interfaces import ICSVDefault, ICSVFile

Verify implementation ::

    >>> verifyClass(ICSVDefault, CSVdefault)
    True
    >>> verifyClass(ICSVFile, CSVFile)
    True



Export / Import in plain format
------------------------------------

Export
+++++++++
here we export folders and documents
::

    >>> self.setRoles(['Manager'])
    >>> id=self.folder.invokeFactory('Document'      , id='doc1'   , title="Document 1")
    >>> id=self.folder.invokeFactory('Document'      , id='doc2'   , title="Document 2")
    >>> id=self.folder.invokeFactory('News Item'     , id='news1'  , title="news 'super' 3")
    >>> id=self.folder.invokeFactory('Document'      , id='doc4'   , title="Document 4")
    >>> id=self.folder.invokeFactory('Folder'        , id='sub1'   , title="mytest")
    >>> id=self.folder.sub1.invokeFactory('Document' , id='doc11'