Gregory Bodnar: Still just telling stories

Thu, 10 Jan 2008

Return from holidays, return to the blog

After a suitably long break from any sort of blog entry, I’ve finally decided to do a bit of work on it. There was a brief moment of panic when I updated the PyBlosxom check-out on this host. I had no idea that the old tag names were removed and replaced with branch names in the repository. This broke things for a few minutes as I relocated links. Things seem back to normal. I’m planning to do a bit of testing with the 1.4 release to see if an upgrade breaks things. I don’t expect it will since I’m not doing anything fancy with this blog.

Plans for the next little while include putting the entry files into source control. It’s a natural response to losing a bunch of entries. I don’t think it’ll take a lot of work, it’s just a matter of getting it done. And with luck, I’ll be able to reinsert some of the lost entries along the way, assuming Liferea doesn’t blow its cache any time soon. Longer term plans definitely include some sort of style change. It’s ugly and I know it – clap your hands. The problem with long-term plans is that they take ages for me to get around to them. Maybe for 2008.

I’m thinking of a bit of a content shift for this year. I’ve been in contact with some of the local groups promoting transportation within Wellington. I have a lot of opinions on urban transportation. I’m hoping I can pencil some of them around here. This might require me to fulfill my promise of enabling comments on blog entries, though.

Everything is, of course, wait-and-see. But fingers are crossed.

[2008-01-10T07:20:00Z] | [] | #
[286 words]


Sun, 24 Dec 2006

Dating

I’ve been futzing with the date style for the blog. If this works, this entry should show as Christmas Eve. Yes, I’m at home, coding, on Christmas Eve.

[2006-12-24T07:00:00Z] | [] | #
[28 words]


Wed, 13 Sep 2006

Comments again

Following up on whether or not to enable comments, I think it will be worth to have, but my initial testing didn’t work out properly. The layout of the form caused at least one of the variables to be incorrectly filled when it was returned:


<?xml version="1.0" encoding="iso-8859-1"?>
<item>
<title>Comments?</title>
<ipaddress>66.119.199.39</ipaddress>
<author>Greg</author>
<link>a href=http://www.sapheron.org/http://www.sapheron.org//a</link>
<email>greg@sapheron.org</email>
<source></source>
<pubDate>1157623883.21</pubDate>
<description>The form is ugly, and I'm sure that the final display will be no better, but this should give me an idea of whether this works or not.</description>
</item>

I also noticed that the comments directory was put into the cgi directory where pyblosxom is actually called from. I wasn’t expecting that, and need to track down why it wasn’t being put alongside the data directory that is used for the entries. Once I get that in place, some level of security will probably have to be put in place.

With my impending shift of houses, I’m expecting that this will be put off until I get settled into the new house. Any complaints about the delay will have to wait until then.

[2006-09-12T21:33:00Z] | [] | #
[186 words]


Thu, 07 Sep 2006

Comments?

I’ve been keeping a casual eye on the access logs for me, and I’ve been noticing that the traffic distribution has been shifting. Since the dawn of time, I’d see activity from crawlers and a few addresses that I could mostly recognise as friends around the world. Over the last few weeks, I’ve been seeing more regular requests from addresses that I can’t account for, and getting a few referrals from Google.

When I originally set up Pyblosxom, I’d specifically left out the comments plugin. Who needs the comment spam, when everyone who reads an entry already knows how to get in touch with me? With the increase in activity, I’m starting to rethink that decision. Before I decide anything, I’ll need to have a read through the plugin and see what sort of work is involved in setting it up. I’m somewhat lazy in cases like this, and can be quite easily deterred by a fair amount of non-trivial work, especially given the distinct possibility that I could be incredibly frustrated by comment spam in a short while.

I should have time to read through the plugin today, and I should actually make a decision by the weekend.

[2006-09-06T21:17:00Z] | [] | #
[202 words]


Fri, 31 Mar 2006

Time Zone

For the longest time, I put up with the time and date of my entries here being wrong. I thought that I looked around to find a solution, but I must have dreamed the whole thing. I found an old pointer from 2003 which provides the simple solution.

On top of my config.py now lives:


# Start out by setting the correct time zone for the owner
import os
os.environ['TZ'] = 'Pacific/Auckland'

I can’t believe I put up with that for as long as I have. It’s almost embarassing…

[2006-03-31T01:54:00Z] | [] | #
[94 words]


Fri, 24 Mar 2006

Pyblosxom in subversion

The transition went faster than I expected, and the shift has already been made. However, Sourceforge only allows subversion accesses over a SSL connection and the version of svn compiled on sapheron.org doesn’t have ssl support built in. Blame my laziness when I built it ages ago. I’ll have to get that rebuilt before I can get access to the svn server.

[2006-03-24T05:13:00Z] | [] | #
[65 words]

Pyblosxom errors

Beginning with my little snafu last week involving an errant cvs update, I’ve noticed a few errors filling the log files. It doesn’t seem to happen every time a request is made, which is why I didn’t notice at first. However, there are several errors every day, so it’s far from isolated.


Traceback (most recent call last):
  File "/usr/home/greg/lib/cgi-bin/pyblosxom.cgi", line 82, in ?
    p.run()
  File "/usr/home/greg/pyblosxom/Pyblosxom/pyblosxom.py", line 166, in run
    blosxom_handler(self._request)
  File "/usr/home/greg/pyblosxom/Pyblosxom/pyblosxom.py", line 856, in blosxom_handler
    renderer.render()
  File "/usr/home/greg/pyblosxom/Pyblosxom/renderers/blosxom.py", line 320, in render
    self._processContent()
  File "/usr/home/greg/pyblosxom/Pyblosxom/renderers/blosxom.py", line 270, in _processContent
    output, current_date = self._processEntry(entry, current_date)
  File "/usr/home/greg/pyblosxom/Pyblosxom/renderers/blosxom.py", line 228, in _processEntry
    if entry["date"] and entry['date'] != current_date:
  File "/usr/home/greg/pyblosxom/Pyblosxom/entries/base.py", line 232, in __getitem__
    return self.getMetadata(key, default)
  File "/usr/home/greg/pyblosxom/Pyblosxom/entries/fileentry.py", line 108, in getMetadata
    self.__populateData()
  File "/usr/home/greg/pyblosxom/Pyblosxom/entries/fileentry.py", line 162, in __populateData
    entrydict = eparser(self._filename, self._request)
  File "/usr/home/greg/pyblosxom/Pyblosxom/pyblosxom.py", line 909, in blosxom_entry_parser
    entryData[meta[0].strip()] = meta[1].strip()
IndexError: list index out of range

I can see how some malformedness can cause a problem, however. Here is the offending block:


    # absorb meta data lines which begin with a #
    while lines and lines[0].startswith("#"):
        meta = lines.pop(0)
        meta = meta[1:].strip()     # remove the hash
        meta = meta.split(" ", 1)
        entryData[meta[0].strip()] = meta[1].strip()

At the beginning of a file entry, there is a section to provide metadata. Lines that begin with # will be marked as metadata containers, which get passed into the dictionary entryData. If a malformed line were passed in, such as:


#MalformedLine

it could not be used to form a key/value pair to insert into the dictionary, and the above error would be raised.

There was one recent change that came through this file:


1.75         (willhelm 11-Nov-05):     while lines and lines[0].startswith("#"):
1.74         (willhelm 11-Nov-05):         meta = lines.pop(0)
1.74         (willhelm 11-Nov-05):         meta = meta[1:].strip()     # remove the hash
1.89         (willhelm 28-Dec-05):         meta = meta.split(" ", 1)
1.76         (willhelm 12-Nov-05):         entryData[meta[0].strip()] = meta[1].strip()

I don’t want to just randomly screw with the checkout unless I have to, so my apologies if you get random errors. I will try to get this fixed up, but the first step is to clean up how my installation is organised. A recent posting to the pyblosxom-devel mailing list indicates that the repository is about be moved from cvs to svn. This move would be a push to get that management in place so that I can screw around without causing damage like this.

In the meantime, I guess I’ll just have to track down any files that might have offending metadata lines and fix them without redating the entries.

[2006-03-24T01:29:00Z] | [] | #
[440 words]


Tue, 21 Mar 2006

How to break things

It’s hard to say what was going through my head when I was typing cvs up within my pyblosxom checkout directory. If I had a sensible layout to my working directory structure, it wouldn’t be such a big deal, but my live weblog draws its internals directly from my cvs checkout location. There were quite a few changes made between my last update and this one, but at least they have been small changes. There were only two files which came up as conflicted, which made fixing relatively quick.

Things seem to be in fair working order again and I hope no one else saw the 500 Internal Server Error. The lesson learned is that I really should pull the live code a layer away from the surface so I don’t do that again. Of course, if I had time to do that, I’d probably spend it playing around with CherryPy instead.

[2006-03-21T04:44:00Z] | [] | #
[153 words]


Mon, 10 Oct 2005

Escaping PyBlosxom variables

I’m not overly sure how one is supposed to directly render text based on variables that would be expanded, but this entry is very wrong.

[2005-10-10T08:46:00Z] | [] | #
[26 words]

Small configuration change

When I set up the pycategories plugin, I used a configuration that was provided by example in the documentation within the plugin. This was suggested as a possibility:

py["category_start"] = ""
py["category_begin"] = ""
py["category_item"] = r'%(indent)s%(category)s (%(count)d)
' py["category_end"] = "" py["category_finish"] = ""

There’s a small problem with the item listing: it doesn’t work with nested categories. However the plugin also creates the variable %(fullcategory), which fixes the problem, as so:

py["category_start"] = ""
py["category_begin"] = ""
py["category_item"] = r'%(indent)s%(category)s (%(count)d)
' py["category_end"] = "" py["category_finish"] = ""
[2005-10-10T08:39:00Z] | [] | #
[96 words]