Help with trackback.py and autoping

Other PyBlosxomers have been nice enough to listen to my various gripes about plug-ins and extras, and to lend a hand (thanks guys: that was quick).

Ted Leung rolled in the various changes to trackback.py that I'd accumulated from various other hackers. If you use trackbacks in your pyBlosxom install, get the latest from ted's site. Looks as if he also has an updated version of commentAPI.py, so I copped that. He added a plug-in, xmlrpc_pingback.py, but I wasn't sure precisely what it did since it didn't have the standard plug-in doc header. I may pore through the code when I get a chance.

Eric Gaumer put a lot of work into the autoping plugin. He hasn't released his patched version, but I'll look out for it soon. He tried to use it to ping back my site, but apparently my trackback/pingback RDF was wrong. I think I've fixed it. If you try to ping Copia through a comment URL and it fails again, please let me know.

[Uche Ogbuji]

via Copia

Using post date for PyBlosxom file hierarchy

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:

$datadir/2005/04/07/Quotidie.txt

and today's in

$datadir/2005/04/08/Quotidie.txt

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:

$datadir/20050408/Quotidie.txt

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.

[Uche Ogbuji]

via Copia

Keywords on Copia

We started out by using PyBlosxom's categories here on Copia, but they were clearly never going to quite cut it. We needed multiple categories. Thankfully I found Bill Mill's keywords plugin (this is probably a more permanent link). It's one of the few PyBlosxom modules I haven't had to hack to get working. I did have to spelunk in his code to figure out that the $keywords story template variable has all the keywords for a specific story: this part was not documented in the doc string of the plug-in (it mentions the $all_keywords variable, which is more useful in other templates in a flavor).

[Uche Ogbuji]

via Copia

PyMarkdown for PyBlosxom

download

The PyBlosxom plug-in registry lists pymarkdown.py, by Tollef Fog Heen as a PyBlosxom plug-in. Odd thing is that the downloaded file seems to implement Markdown just fine, but not the PyBloxsom plug-in API.

So I hacked up this script that does so. It's basically http://err.no/pymarkdown/pymarkdown.py with the PyBlosxom plug-in stuff implemented. I'm truly a Blosxom newbie and I just did a cut&paste+hack from other plug-ins I saw, but it seems to work for my blog.

[Uche Ogbuji]

via Copia