xmlrpc_metaweblog patch

Rob Knapp <myddrin-Wl/[email protected]>
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
Hi everyone,

I've been working with PyBlosxom quite a bit lately. I really like the
structure, and the contrib plugins are quite nice.  However, I couldn't
quite seem to get the xmlrpc_metaweblog plugin to work with Deepest
Sender. (As well as some other personal code that will be released
towards the end of the week.)

So, last night I went in and tootled around and found that
xmlrpc_metaweblog returns a straight string list when getCategories is
called.  Reviewing the RFC at http://www.xmlrpc.com/metaWeblogApi , it
looks like it should be returning a list of dictionaries with
description, htmlUrl and rssUrl entries.

After making that change, I'm happy to report that deepest sender works
seamlessly.  

The attached patch patches the xmlrpc_metaweblog that shipped with
contrib-1.2.2, so it very well may be redundant.  However, I thought I'd
hand it over to all of you for consideration, poking fun at, or what
ever you choose to do.

It actually adds a few extra non-required parameters, since I started by
looking at what my old blogging system (Wordpress 2.0) returned.  I left
them in just in case some other Blog Poster looks for those as well.

I don't (currently) subscribe to the list, so if you have any questions,
please include me on the response.
pyblosxom_patch.diff (text/x-patch, 1.5 KB)
--- xmlrpc_metaweblog.py.old	2006-04-25 04:23:16.000000000 -0700
+++ xmlrpc_metaweblog.py	2006-04-24 17:33:07.000000000 -0700
@@ -39,6 +39,7 @@
 import os, xmlrpclib, re, time, os.path
 from Pyblosxom import tools, plugin_utils
 from Pyblosxom.entries.fileentry import FileEntry
+import autoping
 
 def cb_start(args):
     request = args["request"]
@@ -428,6 +429,13 @@
 
     @return a list of the available categories
     @rtype list
+    RJK -- return a dict with properties:
+    categoryId
+    description
+    categoryName
+    htmlUrl
+    rssUrl
+    To meet expectations of some blog posting clients
     """
     # now make a list of all the categories
     # bypass tools.walk in order to pickup empty categories
@@ -438,7 +446,15 @@
         if dirname==root:
             return
         if not dirname.endswith('CVS') and not dirname.startswith(root+'/comments'):
-            arg.append(dirname.replace(root+'/',''))
+            cleanDirName = dirname.replace(root + '/', '')
+            dirDescriptor = {}
+            dirDescriptor["categoryId"] = cleanDirName
+            dirDescriptor["description"] = cleanDirName
+            dirDescriptor["categoryName"] = cleanDirName
+            dirDescriptor["htmlUrl"] = config["base_url"] + "/" + cleanDirName
+            dirDescriptor["rssURL"] = config["base_url"] + "/" + cleanDirName +"/?flavor=rss"
+            #arg.append(dirname.replace(root+'/',''))
+            arg.append(dirDescriptor)
 
     clist = []
     os.path.walk(root, walk_filter, clist)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.