How to install charm
- Download and install ActivePython
- Open Command Prompt
- Type
pypm install charm
Lastest release
Contents
charm
(Formerly mr.importer, formerly parse2plone.)
Import static websites on the file system into Plone via:
$ bin/plone run bin/charm /path/to/files
Works like a charm!
Warning
This is more of a "toy" project than a "real" data migrator. For any serious Plone migrations, you may want to consider a collective.transmogrifier-based tool e.g. mr.migrator. That is not to say you will not find charm useful as a sample migration script, just that you should not expect it to scale to meet any complex needs; whereas that is exactly what transmogrifier-based tools are designed to do.
Introduction
charm is a Buildout recipe that creates a script for you to get content from static websites on the file system into Plone.
Note
This is a Buildout recipe for use with Plone; by itself it does nothing. If you don't know what Plone is, please see: http://plone.org. If you don't know what Buildout is, please see: http://www.buildout.org/.
charm relies on the "run" argument of scripts created by plone.recipe.zope2instance to mount and modify the Plone database.
Getting started
- A Plone site object must exist in the Zope2 instance database. By default, charm assumes the site object is named "Plone".
- A user must exist in the Zope2 instance database (or Plone site). By default, charm assumes the user is named "admin".
Note
This recipe creates a script that is not intended to be run directly. Due to technical limitations, the author was not able to implement a user friendly error message. So if you run bin/charm directly you will see this:
$ bin/charm Traceback (most recent call last): File "bin/charm", line 117, in <module> charm.main(app=app) NameError: name 'app' is not defined
To avoid this, run the script as intended:
$ bin/plone run bin/charm /path/to/files
See the execution section below for more information.
Installation
You can install charm by editing your buildout.cfg file like so:
[buildout] ... parts = ... charm [charm] recipe = charm
Now run bin/buildout as usual.
Execution
Now you can run charm like this:
$ bin/plone run bin/charm /path/to/files
Note
In the example above and examples below, bin/plone refers to a Zope 2 instance script created by plone.recipe.zope2instance.
Your bin/plone script may be called bin/instance or bin/client, etc. instead.
Example
If you have a site in /var/www/html that contains the following:
/var/www/html/index.html /var/www/html/about/index.html
You should run:
$ bin/plone run bin/charm /var/www/html
And the following will be created:
Troubleshooting
Here are some trouble-shooting comments/tips.
Compiling lxml
charm requires lxml which in turn requires libxml2 and libxslt. If you do not have lxml installed "globally" (i.e. in your system Python's site-packages directory) then Buildout will try to install it for you. At this point lxml will look for the libxml2/libxslt2 development libraries to build against, and if you don't have them installed on your system already your mileage may vary (i.e. Buildout will fail).
Database access
Before running charm, you must either stop your Plone site or use ZEO. Otherwise charm will not be able to access the database.
Contact
Questions/comments/concerns? Please e-mail: aclark@aclark.net.
Credits
Development sponsored by Radio Free Asia
Contributors
- Alex Clark [aclark4life]
- Derek Broughton [derek]
History
1.0b4 (03/23/2011)
- Bug fix for when not --match'ing.
1.0b3 (03/22/2011)
- Include the damn data
1.0b2 (03/22/2011)
- Fix package
1.0b1 (03/22/2011)
- Rename mr.importer to charm
- mr.importer was not that clever, and the author missed flat namespace
- Get rid of all buildout options, support command line args only
- Make _setup_app optionally accept user, else use system user
- Fix broken tests; remove unneccessary; now at 34% coverage
- 619 34% charm (/Users/aclark/Developer/charm/charm.py)
- Doc fixes; clean up / scale down
- Many bug fixes
1.0a5 (02/05/2011)
- Rename parse2plone to mr.importer
- Repackage as needed
- Switch to kwargs in main()
- Better _SETTINGS handling
- Add support for illegal_expressions check
- Add "Keep going!" feature (to ignore errors)
- Add all HTML4 tags to target_tags
1.0a4 (01/12/2011)
- Remove Plone dep
1.0a3 (11/17/2010)
- Bug fix: TypeError: join() takes exactly one argument (2 given) related to specifying import dir on on command line (as args[0]) fixed
- Fix tests
1.0a2 (11/17/2010)
- Add spreadsheet import feature
- Fix docs
1.0a1 (11/17/2010)
- Moved development to the (experimental) collective on Github
0.9.9 (11/16/2010)
- Added a large number of tests; performed associated refactoring; 50% test coverage
0.9.8 (11/12/2010)
- Add "paths" feature to allow multi-import dirs (on the file system), and corresponding object paths (in Plone) to be specified.
0.9.7 (11/08/2010)
- Fix import error
- Add file handler to logger; saves output to a file called "parse2plone.log"
0.9.6 (11/08/2010)
- Fixes to "match" feature
- Combine all modules into one
- Remove a stray pdb (!)
- Add tests (we're at 20% test coverage people!)
- Update docs
0.9.5 (11/08/2010)
- Add match feature
- Add more project justifications to the docs
0.9.4 (11/06/2010)
- Remove bin/import script whenever recipe is uninstalled [aclark4life]
- Add support for XPath syntax in target_tags [derek]
- Add "typeswap" feature [aclark4life]
- Update docs [aclark4life]
0.9.3 (11/04/2010)
- Add Plone 2.5 compat
- Bug fixes
- Better handling of file system path; better base dir calculation
0.9.2 (11/03/2010)
- More doc fixes
0.9.1 (11/03/2010)
- Doc fixes
0.9.0 (11/03/2010)
- Fix regressions introduced (or unresolved as of) 0.8.2. Thanks Derek
Broughton for the bug report(s)
- Many fixes to convert_parameter_values() method which converts recipe parameters to arguments passed to main()
- Fix "slugify" feature
0.8.2 (11/02/2010)
- Add rename feature
- Fix regressions introduced in 0.8.1
0.8.1 (10/29/2010)
- Refactor options/parameters functionality to universally support _SETTINGS dict
- Add "slugify" feature
- Doc fixes
- Add support to optionally publish content after creation
- Add support for generic file import
0.8 (10/27/2010)
- Support the importing of content to folders within the Plone site object
0.7 (10/25/2010)
- Documentation fixes
0.6 (10/25/2010)
- Support customization via recipe parameters and command line arguments
0.5 (10/22/2010)
- Revert 'Add Plone to install_requires'
0.4 (10/22/2010)
- Add 'Plone' to install_requires
0.3 (10/22/2010)
- Another setuptools fix
0.2 (10/22/2010)
- Setuptools fix
0.1 (10/21/2010)
- Initial release