A simple example of how to use collective.transmogrifier
This package shows you how to use collective.transmogrifier to import news items into Plone.
By default, it uses dummy values that are hard-coded in the product itself to create some News Items, so you can see how to even use transmogrifier.
The main idea is that you can use this product as a skeleton for migrating content from other systems to Plone, since you only need to pass in correct data instead of hard-coded dummy values.
Examples of real-life parsing HTML to extract data you need can be found in /branches folder of the product’s repository at http://svn.plone.org/svn/collective/niteoweb.transmogrifier.simpleusage/branches/.
The product sets the following fields on newly created News Items:
Run the following set of commands:
$ cd <workspace> $ virtualenv -p python2.4 --no-site-packages simpleusage $ cd simpleusage $ svn co https://svn.plone.org/svn/collective/niteoweb.transmogrifier.simpleusage/trunk ./ $ bin/python bootstrap.py $ bin/buildout $ bin/instance fg
Then start your favorite browser and point it to http://localhost:8080/manage to add a new Plone site. You can now use the following URL to start importing News Items: http://localhost:8080/<your_site_id>/@@import
First, create a branch for you to work on:
$ cd <workspace> $ virtualenv -p python2.4 --no-site-packages johns_migration $ cd johns_migration $ svn copy https://svn.plone.org/svn/collective/niteoweb.transmogrifier.simpleusage/trunk https://svn.plone.org/svn/collective/niteoweb.transmogrifier.simpleusage/branches/johns_migration
Then, checkout your branch and build a development environment:
$ svn co https://svn.plone.org/svn/collective/niteoweb.transmogrifier.simpleusage/branches/johns_migration ./ $ bin/python bootstrap.py $ bin/buildout
Now you have everything you need to start your own migration. Open <workspace>/johns_migration/src/niteoweb.transmogrifier.simpleusage/transmogrifier.py in your favorite text editor. Scroll all the way to the bottom to find a method ‘source’ and modify it so that it parses data from your source and returns it as a list of dicts.
Once you’re done, start Zope and point your browser to http://localhost:8080/<your_site_id>/@@import to start importing!
- Added newlines to long description.
- Initial release. [zupo]