Transmogrifier: content migration and time traveling

  • 371 views
Uploaded on

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

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

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
371
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
5
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. TRANSMOGRIFIER Content Migration & Time Traveling PloneConf 2013 Brasilia
  • 2. Content Migration One fundamental need of a CMS is Content – where does it  come from? Legacy systems Static HTML Legacy Plone
  • 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. Enters the TRANSMOGRIFIER …
  • 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. 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. TRANSMOGRIFIER … Advantages and Drawbacks of a configuration file: - Advantages: No code - Drawbacks: NO CODE (but that is just me :-) )
  • 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. 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. Running TRANSMOGRIFIER … Use a debugging zope instance, and trigger it right from the core (but that is just me:-) )
  • 11. SC.TRANSMOGRIFIER … Inner workings: @blueprint class MyBluePrint(BluePrintBoiler):     OPTIONS = {“path”:(“/home”,),  }     def transmogrify(self, item): # Do things        return item # grok boilerplate
  • 12. SC.TRANSMOGRIFIER. WHITEHOLE Blueprint… When you need to dispatch contents BACK in the pipeline
  • 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. Transmogrifier Ploneconf 2013 Brasilia João S. O. Bueno jsbueno@simplesconsultoria.com.br