Transmogrifier: content migration and time traveling

826 views
608 views

Published on

Words on what is, how to use, and some sucessfull practices using collective.transmogrifier for importing legacy content into Plone.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
826
On SlideShare
0
From Embeds
0
Number of Embeds
28
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transmogrifier: content migration and time traveling

  1. 1. TRANSMOGRIFIER Content Migration & Time Traveling PloneConf 2013 Brasilia
  2. 2. Content Migration One fundamental need of a CMS is Content – where does it  come from? Legacy systems Static HTML Legacy Plone
  3. 3. Content Migration Normally  you could think on code like this: for content_item in item_source:     content_item = normalize_unicode(content_item)     content_item = sanitize_html(content_item)     item_location = infer_item_path(content_item)     ...     content_item, related_links =  extract_links_from_content(content_item)     create_plone_content(item_location, content_item)     setup_related_items(item_location, related_links)     ...     log_creation(content_item) …
  4. 4. Enters the TRANSMOGRIFIER …
  5. 5. Enters the TRANSMOGRIFIER … The same code Idea – but each stage of the transform needed Is encapsulated in a “blueprint” Só you have one blueprint to fetch each content item One blueprint to normalize the text encoding One blueprint to filter the html And instead of configuring them in a hardcoded procedure, You write a “transmogrifier configuration file”
  6. 6. TRANSMOGRIFIER … [transmogrifier] pipeline =     contents     authorize     skipnotify     decoder     unescape     parsetosoup     …    constructor     schema_update    workflow [contents] limit = 50 base_path = /home/.../simples/content_dir upload_path = /Plone/News blueprint = example.transmogrifier.filesource
  7. 7. TRANSMOGRIFIER … Advantages and Drawbacks of a configuration file: - Advantages: No code - Drawbacks: NO CODE (but that is just me :-) )
  8. 8. TRANSMOGRIFIER … Inner workings: class MyBluePrint(object):     def __init__(self, transmogrifier, name, options, previous):         self.previous = previous         ...                def __iter__(self):         for item in self.previous:             # Do things             yield item # grok boilerplate
  9. 9. TRANSMOGRIFIER … Lots of existing Packages – with lots of Blueprints sc.transmogrifier plone.app.transmogrifier mr.migrator Funnelweb dexterity.transmogrify collective.jsonmigrator/jsonify sc.transmogrifier
  10. 10. Running TRANSMOGRIFIER … Use a debugging zope instance, and trigger it right from the core (but that is just me:-) )
  11. 11. SC.TRANSMOGRIFIER … Inner workings: @blueprint class MyBluePrint(BluePrintBoiler):     OPTIONS = {“path”:(“/home”,),  }     def transmogrify(self, item): # Do things        return item # grok boilerplate
  12. 12. SC.TRANSMOGRIFIER. WHITEHOLE Blueprint… When you need to dispatch contents BACK in the pipeline
  13. 13. SC.TRANSMOGRIFIER. WHITEHOLE Blueprint…   def __iter__(self):       for item in self.previous:           for time_traveler in self.storage["wormhole"].iterpop():               logger.info(...)               yield time_traveler           yield item
  14. 14. Transmogrifier Ploneconf 2013 Brasilia João S. O. Bueno jsbueno@simplesconsultoria.com.br

×