download customized xmlrpc_blogger.py
download patch to xmlrpc_blogger.py
Most PyBlosxom tools seem to like the pattern of piling all blog entry files into the top-level
datadir, or using at most one level of hierarchy in the form of simple categories. Yuck. Here is an example of resulting ugliness: I like to post entries entitled Quotidie every day. It used to be in Copia that the first one gets lumped into top-level as
Quotidie.txt. When I post the next one using BloGTK, the XML-RPC back end would detect a filename clash and choose an alternate file name such as
Quotidie5gJS68ade.txt. It would be nice if it could pick a prettier means for disambiguation (e.g.
Quotidie.txt). I understand this wouldn't be all that easy to do because of problems with race conditions, but of course, it would be nice if such clashes were just extremely rare in the first place.
IMO The obvious way to do this is to use the date for disambiguation. I'm sure others have done such things (there is at least one plug-in I've seen that uses an embedded date in the filename to preserve the posting date), but I couldn't find very much about this idea on the Net. I ended up just looking into what it would take to hack something for Copia. The goal is to have each entry in a hierarchy according to date so that yesterday's Quotidie would be found in:
and today's in
I use keywords rather than categories for PyBlosxom, so the directory structure has no semantic meaning for purposes of Copia. Since I usually post through blogging tools over xml-rpc, it turned out that it was enough to patch xmlrpc_blogger.py. While working on this plug-in I recoiled at how the file naming code is thrown carelessly into the body of the
newPost function. I broke that functionality out into a new function
blog_document_name, which returns the name of the file for the blog entry. This makes it easier for people to hack their own naming algorithms. My specialization implements the date-based hierarchy described above.
It seems there is still some work to be done. For one thing BloGTK doesn't seem to be able to find the files within this hierarchy when looking for postings to edit or delete. For another, PyBlosxom seems to get confused because permalinks to entries within the date-based hierarchy pulls in other entries as well as the intended one. I guess I have to learn more about how PyBlosxom manages its $datadir.
Update: I figured out this problem. PyBlosxom looks for discrete dates and years in the request URL, in order to handle requests for "all entries on day D". Turns out that a URL component of the form "20050408" doesn't trip this algorithm, so I just went with a structure of the form:
See the top of this post for links to to my custom xmlrpc_blogger.py and a patch from the xmlrpc_blogger.py shipped in the PyBlosxom contrib-1.2 package. I hope it helps someone else.