# vim: tabstop=4 shiftwidth=4 expandtab """ Creates Yahoo style navigation Revisions: 1.1 (20041205) - Steven Armstrong - changed to work with category and calendar url's, changed so that /static and 404 requests are not handled 1.0 ? - Wari Wahab $Id: breadcrumbs.py,v 1.2 2006/03/22 20:53:52 sar Exp $ """ __author__ = "Wari Wahab - wari at wari dot per dot sg" __version__ = "1.1 (20041204)" __url__ = "http://roughingit.subtlehints.net/code/" __description__ = "Creates a Yahoo style navigation" SEPERATOR=' :: ' from Pyblosxom import tools import os, string class BreadCrumbs: def __init__(self, request): self._request = request self._crumbs = '' def __str__(self): self.littleCrumbs() return str(self._crumbs) def littleCrumbs(self): conf = self._request.getConfiguration() data = self._request.getData() #path = string.replace(data['root_datadir'], conf['datadir'], '') #crumblets = path.split(os.sep) # make breadcrumbs work with both category and calendar url's # e.g. /weblog/category/entry and /weblog/2004/11 crumblets = data['path_info'] path = os.sep + os.sep.join(crumblets) path_data = [] # add a the root of the weblog to the breadcrumbs if path == "/": pass #path_data.append('home') else: path_data.append('home' % conf['base_url']) if len(crumblets) > 0: crumbs = '' for mem in crumblets: if mem: crumbs += '/%s' % mem if crumbs != path: path_data.append('%s' % (conf['base_url'], crumbs, mem)) else: if ".txt" in mem: mem = mem[:-4] path_data.append(mem) self._crumbs = '