path variable in story template
"Sebastian Spaeth" <[email protected]> Wed, 20 Jan 2010 11:40:57 +0100
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
I have the problem in current 1.5 trunk that my categories in the feed
start with a '/', e.g. "/Private" and have tracked down the problem. The
tag is defined by the 'path' template variable which is set in
fileentry.py and I found it's calculation to be a bit weird. Please find
below a patch that makes it a bit prettier and actually removes the
initial slash. Please apply if this looks ok to you.
diff -r 7c8cb08f38eb pyblosxom/Pyblosxom/entries/fileentry.py
--- a/pyblosxom/Pyblosxom/entries/fileentry.py Mon Jan 18 09:34:41 2010 +0100
+++ b/pyblosxom/Pyblosxom/entries/fileentry.py Wed Jan 20 11:34:40 2010 +0100
@@ -128,19 +128,13 @@
We then parse the file and fill in the rest of the information
that we know.
"""
- file_basename = os.path.basename(self._filename)
+ (path, file_basename) = os.path.split(self._filename)
+ path = path.replace(self._root,'')
+ if path.startswith(os.sep):
+ path = path[1:]
- path = self._filename.replace(self._root, '')
- path = path.replace(os.path.basename(self._filename), '')
- path = path[:-1]
-
- absolute_path = self._filename.replace(self._datadir, '')
- absolute_path = self._filename.replace(self._datadir, '', 1)
- absolute_path = absolute_path.replace(file_basename, '')
- absolute_path = absolute_path[1:][:-1]
-
- if absolute_path and absolute_path[-1] == "/":
- absolute_path = absolute_path[0:-1]
+ absolute_path = os.path.dirname(self._filename)
+ absolute_path = re.sub('^' + self._datadir + '/?', '', absolute_path)
filenamenoext = os.path.splitext(file_basename)[0]
if absolute_path == '':
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev