from a Yahoo! and XML geek

Quick Links: Consulting | Book info | Brain Attic | Home

Push Button Paradise

Micah Dubinko

Mon, 09 May 2005

Breaking stuff, fixing stuff

I made a small change to how permalinks are stored under PyBlosxom. Instead of 2005/05/article.txt, it's now 2005-05/article.txt.

It has to do with this (pyBlosxom.py, line 850):

    # Match dates with files if applicable
    if data['pi_yr']:
        # This is called when a date has been requested, e.g. /some/category/2004/Sep
        month = (data['pi_mo'] in tools.month2num.keys() and tools.month2num[data['pi_mo']] or data['pi_mo'])
        matchstr = "^" + data["pi_yr"] + month + data["pi_da"]
        valid_list = [x for x in entrylist if re.match(matchstr, x[1]._fulltime)]
    else:
        valid_list = entrylist

Out of the box, as of version 1.2, PyBlosxom isn't compatible with the common practice of structuring your URL space as whatever/YYYY/MM/article.html. The system will give you permalinks to things like 2005/05/article.html, at at least they won't be a 404, but they will all be identical, and all have all the posts for the given year/month. If there were a PyBlosxom FAQ, this would probably be in it. :)

Why does this happen? When the request URL has something like 2005/05 in it, PyBlosxom goes into 'show all posts in that date range' mode. This is pi_yr and pi_mo in the code above. So anything on the URL after the date part gets ignored, and it basically doesn't matter at that point how your datadir is laid out.

If you really want your PyBlosxom blog to store things this way, you'll need to write a plugin that overrides cb_pathinfo. Keep in mind, though, that you'd still need a way to get at your archives.

Thanks to Uche for helping me figure this out. -m

posted at: 23:12 | under: 2005-05 | 0 comment(s)




Syndicate: RSS feed

What am I reading?
Don Quixote
Self-Editing for Fiction Writers
The Complete Joy of Homebrewing
Analog magazine
Compilers
TAOCP


What am I browsing?
BlogFour
Blake Ross
Brianstorms
Caveat Lector
Claus Wahlers
Copia
Cringely
David Temkin
Dave Hyatt
Groklaw
Mark Birbeck
M.David
Miguel de Icaza
Mitch Kapor
Norm Walsh
Omar Tazi
Sean McGrath
Sjoerd Visscher
Ted Leung
Tom Bradford
Wil Wheaton


Archives:
Link

Powered by PyBlosxom