xmlrpc changes on python 2.5 and MetaWeblog
While working to add MetaWeblog support to my blog (not that I’m writing lots of stuff here and I need a ‘desktop blogging tool’ to increase my productivity) I found some very helpful links how to add this to a Django based blog. Greg Abbas wrote two tutorials on how to integrate XMLRPC into Django and Metaweblog and Django. Everything fine and dandy until I tried to integrate the XMLRPC part into my system. I’ve started with the ‘arithmetic’ example, but I got the following error message:
xmlrpclib.ProtocolError: <ProtocolError for localhost:8000/blog/metaweblog/: 500 INTERNAL SERVER ERROR>
It was strange for me to see that my previous play with XML RPC (used in another part of the system) didn’t work either. It worked on the production server, but not on my development machine. One of the major differences between these servers was that I was using python 2.5 on my dev server and python 2.4 on the live server. After I’ve google it around a bit, I found that there were some differences between the 2.4 and 2.5 implementation of xmlrpclib. If you check the release note for python 2.5 there is a small mention:
- Patches #893642, #1039083: add allow_none, encoding
arguments to constructors of SimpleXMLRPCServer and
CGIXMLRPCRequestHandler.
And incidentally, SimpleXMLRPCServer is used by both XMLRPC implementations.
The fix is pretty easy: add the missing parameters (allow_none – Bool and encoding – String) when you instantiate SimpleXMLRPCServer or any class based on that.
After fixing this, I still had to adapt my models to the Metaweblog API. Thanks to ecto‘s trial version, it wasn’t a very hard job. I prefer to write my posts in Textile so now I have to see how I can make ecto or other blogging tool to let me to that.
Posted 11 March 2008 in: tips