I hacked up a Python script to merge my old blog with my new Python Desktop Server blog. It uses the PyDS MetaWeblogAPI.
The script is here. Not pretty but it's something. It reads entries from my Natara DayNotez database,
sees if they are already in the PyDS blog and if they are not it posts them. I had to make a small
change to PyDS to give the posts the correct creation date. To do this I added one line to MetaWeblogAPI.py:
id = weblog.postNewEntry(
struct.get('title',''),
struct.get('link',''),
struct.get('description',''),
struct.get('source',{}).get('name',''),
struct.get('source',{}).get('url',''),
onhome=publish and not(struct.get('flNotOnHomePage',0)),
pubtime=int(struct.get('pubtime', '0')),
categories=categories,
structured=structured)
return id
Uploading wentsmoothly after one tricky problem. The £ character caused problems with XML. I eventually got
around this by converting the title and description fields to unicode before posting:
oPost['title'] = unicode( strTitle, 'ISO-8859-1')
oPost['description'] = unicode( strRtxNote, 'ISO-8859-1')
I fixed my vim posting script in the same way.
|