Blast from the past!

Thanks to Sidnei da Silva’s handy python script to migrate Plone blog entries to MoveableType format, I was able to modify it for my own use and import 16 posts that were trapped inside a defunct Quills 0.8 blog into this Wordpress blog.

Since there were no comments, I was able to greatly simplify the script. A few other changes that I had to make to get it to export correctly:

  1. Hardcoded the categories since they are all related to Plone and Plone4Artists.
  2. Added a condition to check that the object was actually a weblog entry and not a weblog topic, since with Quills 0.8, both are stored in the same container.
  3. Changed the method from getCookedBody to getBody, since that is how it’s defined in a Quills weblog entry.

## Script (Python) "mtexport"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##

out = context.REQUEST.RESPONSE

for entry in context.weblog.objectValues():
   if getattr(entry, 'meta_type', '') == 'WeblogEntry':
      print >> out, 'TITLE:', entry.Title()
      print >> out, 'AUTHOR:', 'nate'
      print >> out, 'DATE:', entry.created().strftime('%m/%d/%Y %H:%M:%S')
      print >> out, 'STATUS:', 'publish'
      print >> out, 'ALLOW COMMENTS:', '1'
      print >> out, 'ALLOW PINGS:', '1'
      print >> out, 'CONVERT BREAKS:', '0'
      print >> out, 'PRIMARY CATEGORY:', 'plone'
      print >> out, 'CATEGORY:', 'plone4artists'
      print >> out, '-' * 5
      print >> out, 'BODY:'
      print >> out, entry.getBody()
      print >> out, '-' * 8

null = printed
return out

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • LinkedIn
  • MySpace
  • Reddit
  • Slashdot
  • TwitThis

0 Responses to “Blast from the past!”


  1. No Comments

Leave a Reply