From 75a988ba81c7d37e80855b7f4a985323c7db3670 Mon Sep 17 00:00:00 2001
From: Sarah Sharp <sarah@lex.(none)>
Date: Sat, 26 Jul 2008 05:41:13 -0700
Subject: [PATCH] Bug fix for folksonomy tags plugin.

This fixes the case where folksonomy is trying to grab entries for an RSS feed
of entries with a particular tag.  For example:

http://sarah.thesharps.us/tags/open%20source/index.rss

This URL was failing with the following error:

Traceback (most recent call last):
  File "/usr/lib/cgi-bin/pyblosxom.cgi", line 96, in ?
    p.run()
  File "/var/lib/python-support/python2.4/Pyblosxom/pyblosxom.py", line 203, in run
    blosxom_handler(self._request)
  File "/var/lib/python-support/python2.4/Pyblosxom/pyblosxom.py", line 984, in blosxom_handler
    defaultfunc=blosxom_file_list_handler)
  File "/var/lib/python-support/python2.4/Pyblosxom/tools.py", line 759, in run_callback
    output = func(input)
  File "/home/sarah/blog/plugins/folksonomy.py", line 482, in cb_filelist
    return getEntriesForTag( tag, args )
  File "/home/sarah/blog/plugins/folksonomy.py", line 492, in getEntriesForTag
    for entry_location in entrymap[tag]:
KeyError: 'open source/index'

This kludge removes anything after (and including) the forward slash.  So it
won't work if you have slashes in your tags.

Thanks to Jamey Sharp for debugging this with me.

Signed-off-by: Sarah Sharp <sarah@thesharps.us>
---
 plugins/folksonomy.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/plugins/folksonomy.py b/plugins/folksonomy.py
index 0e5b3d2..b2aba0d 100644
--- a/plugins/folksonomy.py
+++ b/plugins/folksonomy.py
@@ -479,6 +479,7 @@ def cb_filelist(args):
 	m = re.compile(r'^%s' % config['tag_url']).match(data['url'])
 	if m:
 		tag = re.sub("%s" % config['tag_url'],'',data['url'])
+		tag = re.sub(r'/.*', '', tag)
 		return getEntriesForTag( tag, args )
 	
 def getEntriesForTag(tag,args):
-- 
1.5.5.1


