Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some changes for plone2.1 export #1

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ba8abb3
1 - Add possibility to configure export via ini file.
yboussard Feb 23, 2011
4db2f82
add some documentation to plone2.0_export.rst
yboussard Feb 24, 2011
2d3c657
add some documentation to plone2.0_export.rst
yboussard Feb 24, 2011
e0c3acf
add some documentation to wrappers
yboussard Feb 24, 2011
4ea9bdb
logger.exception and warnig was redondant and exception have an manda…
yboussard Feb 28, 2011
6e607cf
change the name of section
yboussard Mar 2, 2011
69b9033
add a new blueprint for plonearticle
yboussard Apr 12, 2011
e0b353d
add a new blueprint for plonearticle and linguaplone relation
yboussard Apr 12, 2011
5530990
update documentation
yboussard Apr 12, 2011
6626c34
add a new blueprint for plonearticle and plone relation
yboussard Apr 12, 2011
fb24983
fix export for attachment and plone article. Add relation for linguap…
yboussard Apr 12, 2011
911a4b7
prepare release
yboussard Apr 12, 2011
982d903
add zcml to be include when we release
yboussard Apr 12, 2011
b703970
fix manifest
yboussard Apr 12, 2011
d544abd
add zcml to be include when we release
yboussard Apr 12, 2011
ed539ba
add an error step and fix issue for plonearticle
yboussard Apr 19, 2011
439d189
fix issue on PA3.2
yboussard Apr 19, 2011
b356e0c
prepare release
yboussard Apr 19, 2011
a6d9eaa
fix migration
yboussard Apr 29, 2011
e88727a
Preparing release 0.2.4
yboussard Apr 29, 2011
435b47b
Back to development: 0.2.5
yboussard Apr 29, 2011
6e9250d
fix issue on owner field
yboussard May 1, 2011
4776cbc
get user via acl_users
yboussard May 10, 2011
6224d23
Preparing release 0.2.5
yboussard May 10, 2011
a4d3d32
Back to development: 0.2.6
yboussard May 10, 2011
568f347
fix creators on export
yboussard May 11, 2011
387d0d1
can modify bmp image
yboussard May 11, 2011
13041b5
normalize group identifier and delete prefix group_ on group name
yboussard May 13, 2011
66d9051
prefix group by group_
yboussard May 13, 2011
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include *.txt
recursive-include collective/blueprint/jsonmigrator *
recursive-include export_scripts *
global-include *.zcml
global-exclude *pyc

326 changes: 296 additions & 30 deletions collective/blueprint/jsonmigrator/blueprint.py

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions collective/blueprint/jsonmigrator/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,21 @@
name="collective.blueprint.jsonmigrator.datafields"
/>

<utility
component=".blueprint.LinguaRelation"
name="collective.blueprint.jsonmigrator.linguarelation"
/>

<utility
component=".blueprint.PloneArticleFields"
name="collective.blueprint.jsonmigrator.plonearticle"
/>

<utility
component=".blueprint.ReportError"
name="collective.blueprint.jsonmigrator.reporterror"
/>



</configure>
13 changes: 12 additions & 1 deletion docs/datafields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Expected data structure in pipeline:
* **_path**: path to object on which we want to change local roles.
* **_datafield_<field>**: field which needs to store data

Option configuration:

* datafield-prefix : for changing the prefix (by default _datafield_)
* path-key : for changing the path key
* datafield-separator : for changing separator of prefix

Example
-------

Expand All @@ -38,5 +44,10 @@ Data in pipeline::

{
"_path": "/Plone/index_html",
"_datafield_attachment": "0/1.json-file-1",
"_datafield_attachment": {"filename": "DAF.jpg",
"content_type": "image/jpeg",
"path": "0\\20.json-file-1",
"height": 605,
"size": 63912,
}
}
5 changes: 4 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ List of blueprints built around ``collective.blueprints.jsonmigrator.source``
with purpose of providing flexible infrastructure to do migrations in Plone.

In source of this package in ``exports_scripts`` directory is also a helping
export script ``plone2.0_export.py`` which provides a external method
export script :doc:`plone2.0_export` which provides a external method
``export_plone20`` to export data from Plone 2.0 (script might also work with
higher versions of plone 2.1, 2.5, but was not tested) in format that is
suitable for ``collective.blueprints.jsonmigrator.source`` blueprint.
Expand All @@ -31,6 +31,9 @@ And if you might forgot, migration is a bitch ... so have fun :P
owner <owner>
ac_local_roles <ac_local_roles>
datafields <datafields>
plonearticle <plonearticle>
linguarelation <linguarelation>

.. _`collective.transmogrifier`: http://pypi.python.org/pypi/collective.transmogrifier
.. _`Plone`: http://plone.org

11 changes: 11 additions & 0 deletions docs/jsonsource.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Parameters

Also possible to specify in ``some.package:path/to/json/directory`` way.

:path-separator:
os path separator use in json file (in case of json file is created on windows)

:datafield-prefix:
prefix for indicate file fields prefix. Path is transformed by this blue print

Example
-------

Expand All @@ -23,6 +29,8 @@ Configuration::
[source]
blueprint = collective.blueprint.jsonmigrator.source
path = some.package:/path/to/json/dir
path-separator = \
datafield-prefix = _data_

JSON files structure::

Expand All @@ -43,4 +51,7 @@ JSON file::
"_path": "/Plone/front-page",
"_type": "Document",
...
"_data_backgroundImage": {
"path": "0\\20.json-file-1",
},
}
38 changes: 38 additions & 0 deletions docs/linguarelation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
``collective.blueprint.jsonmigrator.linguarelation``
====================================================

Set linguaplone relaation between contents.

Configuration options
---------------------


Expected data structure in pipeline:

* **_canonical**: path of canonical object


Example
-------

This example will try to store content of ``0/1.json-file-1``

Configuration::

[tranmogrifier]
pipeline =
source
plonearticle

...

[datafields]
blueprint = collective.blueprint.jsonmigrator.linguarelation

Data in pipeline::

{
"_path": "/Plone/index_html-fr",
"_canonical": "/Plone/index_html",

}
6 changes: 2 additions & 4 deletions docs/owner.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ Data in pipeline::

{
"_path": "/Plone/index_html",
"_owner": [
1,
"admin"
],
"_owner": "admin"

}


2 changes: 1 addition & 1 deletion docs/permission_mapping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Configuration::

...

[mimetype]
[permission_mapping]
blueprint = collective.blueprint.jsonmigrator.permission_mapping

Data in pipeline::
Expand Down
181 changes: 181 additions & 0 deletions docs/plone2.0_export.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
``plone2.0_export.py``
======================

Export data from an old plone site.

Installation
------------

* Create an external method in your plone site.

- Copy collective.blueprint.jsonmigrator/export_scripts/plone2.0_export.pt in *INSTANCE/Extensions* directory
- Connect to ZMI
- Add an External Method, and fill out the form with ::

id = your_id
module name = plone_2.0export
method = export_plone20

* Create an jsonmigrator.ini in order to configure export process.


Syntax of configuration
-----------------------


Options
+++++++

* In DEFAULT section

- HOMEDIR => where we create json file. This directory must exists !! Each time that export process is invoked, an new folder is created . In each folder created , every 1000 objects created, script create an new folder. The directory struture look like that::

HOMEDIR
|_ <id_object>_<date_export>
|_ 0
|_ 1.json
|_ 2.json
|_ ...
|_ 999.json
|_ 1
|_ 1000.json
|_ 1001.json
|_ ...
|_ 1999.json
....

You can have also file name loke xxx.json-file-x . This is binary file of exported content.

- CLASSNAME_TO_SKIP_LAUD => This is a list of classname. Object of this classname where are skip by the export process

- CLASSNAME_TO_SKIP => This is a list of classname. Object of this classname where are skip by the export process

- ID_TO_SKIP => This is a list of id object . Object wich id is equal to an member of this list is skipping of the process.

- NON_FOLDERISH_CLASSNAME => This is a list of classname. Object of this classname are considered as non folderish content.

- JUST_TREAT_WAPPER => If true CLASSNAME_TO_SKIP_LAUD and CLASSNAME_TO_SKIP have no effect. Just object that are mapping in CLASSNAME_TO_WAPPER_MAP are treated

- MAX_CACHE_DB => a int number that indicate when the process purge the zodb cache (avoid memory error)

* In CLASSNAME_TO_WAPPER_MAP

- ClassName=Wrapper => you configure the export wrapper use for object of ClassName


Example
+++++++

::

[DEFAULT]
HOMEDIR=c:\dt\plone2.1\export
JUST_TREAT_WAPPER=True
NON_FOLDERISH_CLASSNAME=DPLDTArticle
DPLDTIssue
DPLDTPerformance
DPLDTTraining
MAX_CACHE_DB=250

[CLASSNAME_TO_WAPPER_MAP]
LargePloneFolder=BaseWrapper
Folder=BaseWrapper
PloneSite=BaseWrapper
PloneFolder=BaseWrapper
Document=DocumentWrapper
File=FileWrapper
YourSpecificContentType=ArchetypesWrapper


Existing Wrapper
++++++++++++++++

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: BaseWrapper
:end-before: def


.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: DocumentWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: I18NFolderWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: LinkWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: NewsItemWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: ListCriteriaWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: StringCriteriaWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: SortCriteriaWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: DateCriteriaWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: FileWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: ImageWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: EventWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: ArchetypesWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: I18NLayerWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: Article322Wrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: ArticleWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: ZPhotoWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: ZPhotoSlidesWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: ContentPanels
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: LocalFSWrapper
:end-before: def

.. literalinclude:: ../export_scripts/plone2.0_export.py
:pyobject: ZopeObjectWrapper
:end-before: def





Loading