this blog is girtby.net

Posted
09 December 2008

Categories
Nerd Factor X Meta

Tags
wordpress mephisto

4 Comments

Blog Migration Secrets

So given that the world (still) lacks a decent common export format for blog software, you might wonder how I managed to move the collection of assorted nonsense that is girtby.net from Mephisto to Wordpress.

Actually, there's a real chance you might not wonder this. But let's press on anyway for the sake of Google and future generations.

All the hard work was actually done by Daniel Dave Murphy over at schwuk.com who published the script and a bzr branch. Jason Morrison added MySQL support and published a diff.

I've made some changes of my own and published the results. You can get either:

  • Just the latest m2wp.py script incorporating Jason's and my patches, or
  • A bzr branch, continuing the spirit of being all modern and distributed.

So what sort of changes did I have to make?

Well, Dave's script extracted the rendered HTML into the Wordpress database. This is OK but it means you can't go back and edit old posts in their source form (in my case, Markdown format). So to use my version of the script you need to set up your content filters in Wordpress to match those in Mephisto.

There are a couple of other minor changes, specifically handling NULL as well as empty content (for whatever reason I had some of these fields in my Mephisto database), and a minor formatting problem which prevented the "Read More" links from working properly.

Anyway that's my version of the script, and now that that's out of the way I can get back to procrastinating about doing anything with CSS.

4 Comments

Posted by
Dave
2008-12-09 01:47:56 -0600
#

Glad you found the script useful. I really must patch in some of the changes others have made.

BTW it's Dave, not Daniel. :)


Posted by
alastair
2008-12-09 06:04:26 -0600
#

A thousand pardons, how stupid of me.

Is there enough interest to start a launchpad project now? :)


Posted by
Dave
2008-12-09 06:22:58 -0600
#

No problem. :)

Yeah, why not. I'll get one set up.


Posted by
Jared
2009-01-22 05:29:42 -0600
#

I'm trying run this script, and this is the traceback I was getting:

Traceback (most recent call last):
  File "m2wp-mysql.py", line 291, in <module>
    exporter.export()
  File "m2wp-mysql.py", line 263, in export
    output = self.wxr.finalise()
  File "m2wp-mysql.py", line 193, in finalise
    wxr = self.display()
  File "m2wp-mysql.py", line 72, in display
    return self.xml.toprettyxml('')
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/dom/minidom.py", line 57, in toprettyxml
    self.writexml(writer, "", indent, newl, encoding)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/dom/minidom.py", line 1744, in writexml
    node.writexml(writer, indent, addindent, newl)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/dom/minidom.py", line 814, in writexml
    node.writexml(writer,indent+addindent,addindent,newl)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/dom/minidom.py", line 814, in writexml
    node.writexml(writer,indent+addindent,addindent,newl)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/dom/minidom.py", line 814, in writexml
    node.writexml(writer,indent+addindent,addindent,newl)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/dom/minidom.py", line 814, in writexml
    node.writexml(writer,indent+addindent,addindent,newl)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/dom/minidom.py", line 1143, in writexml
    raise ValueError("']]>' not allowed in a CDATA section")
ValueError: ']]>' not allowed in a CDATA section

I had some hivelogic enkoder blocks in my posts that were causing this. Took them out and everything was ok.