Pyblosxom on windows

Robert Leftwich <robert-NuYOPsrVWqAk+I/[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
I'm attempting to get pyblosxom up and running on windows and after finding 
that the links didn't work I used the approach suggested in the archives of 
modifying the flavor to call a dospath2uri() plugin function to do the 
conversion. This approach works until you bring in other plugins such as 
the category plugin which do not have external template files that can be 
modified, so I started looking for alternatives.

What I ended up with is a modification to the code in the function 
__populateBasicMetadata() in fileentry.py, where I changed the setting of 
the absolute_path and file_path as follows:

         self['absolute_path'] = urllib.pathname2url(absolute_path)
         self['file_path'] = urllib.pathname2url(file_path)

I made a similar change in genitem() in pycategories.py for the link 
generation, i.e.

         return (((len(itemlist)-1) * "&nbsp;&nbsp;") +
                 "<a href=\"%s/%s%s\">%s</a>%s" % (self._baseurl, 
urllib.pathname2url(item), self._flavour, itemlist[-1] +"/", num))

and all is working well. The documentation for urllib.pathname2url() says 
that it will have the desired effect in both Windows and *nix environments, 
with the added advantage that the result is also escaped/quoted correctly.

The negative side of this approach is that if you have any categories with 
spaces (or other escapable characters in them) then any flavor that uses 
the absolute_path or file_path as the target of a link will have the 
escaped characters visible in the browser, e.g. a category of '/has a 
space' becomes '/has%20a%20space', which is not terribly readable.

This leads me to my question (finally!), is this approach a valid one and 
if so should we also add an unquoted version of the absolute_path and 
file_path in __populateBasicMetadata() to allow them to be used in the 
visible parts of html, i.e. something like:

         self['absolute_path_unquoted'] = urllib.unquote(self['absolute_path'])
         self['file_path_unquoted'] = urllib.unquote(self['file_path'])

and the flavor(s) can be modified to use the unquoted version where 
appropriate, e.g.

   [<a href="$base_url/$absolute_path" 
title="Category">$absolute_path_unquoted</a>]

Robert




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
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.