Turn an existing schemata-based product into an ArchGenXML Project
This How-to applies to: Any version.
ArchGenXML
Do you have set up and written your Plone-product by hand, but consider switching over using an UML editor and ArchGenXML to ease your work ?
Here you can read which steps it takes to turn an existing, schemata based product into an AGX project, by the example of the ArcheCSV product (thanks to the ASA1000 team).
I use ArgoUML as UML editor, but you can use any UML editor ArchGenXML can work with (maybe any uml editor?)
ArcheCSV
ArcheCSV is a powerfull product, as it lets you create ATCT based content types by importing the instance-data of the to be created objects by an csv formatted input file. The wizard like interface is implemented by defining different shemata for every wizard page to step through, providing easy save-and-step-to-the-next interface by defining appropriate actions in the relevant page template metadata file.
It uses the csv module from python, and three additional methods in the class body of the main class, Importer. The remaining product logic is in page templates and an import script, all residing in the skins directory.
The Steps
Here are the steps that were necessary:
- get an UML editor and fire it up. I used ArgoUML v0.20 for this how-to
- defining the main class.
- add attributes
- give attributes the appropriate tagged values. These is an easy one-to-one process of the values that were defined in the schemata declaration of the class by hand. Mainly widget, widget:label and widget:description, widget:macro for the hand-written widgets.
- defining the three class methods (getType, getCSVheader, getCSVdata)
- saving the work and giving it a try by throwing the .zargo (the ArgoUML project) file to ArchGenXML
- with no errors, a new product directory is created with complete interiour, like subdirs, __init__.py, config.py files and class definition
- now moving over the skins directory of the hand written product
- copy and paste of the hand written function bodies into the three but empty, pre-generated class methods
- Its possible to declare all import statements needed by the class methods by tagged value import at the class in the diagram.
It can also be done by pasting it directly into the prepared commented area in the generated class file - install product and ready
These steps were perfomed in about an hour, while the author is still no AGX-guru. He never thought it was so easy, so he decided to write this how-to to share the experience with others.
Moved
Great howto, thanks!