Re: Latest CVS on windows
Wari Wahab <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <[email protected]> |
Chris Moffitt wrote:
> Ok, makes sense that I should give it a stab - since I'm the one that
> wants it!
> I'm having a little trouble figuring out where the file_path variable is.
> I tried data['file_path'] and it errors out on me.
Sorry about that, this trick is actually one of the more advanced plugin
mechanism that's avaiable in pyblosxom, and I don't think it's
documented anywhere at all. :) But that's ok, I've got a working example
of this plugin, and tested to be working.
> Here's what I have right now for the plugin -
> data["dosconv"] = "output goes here"
Yeah, the interesting part of pyblosxom plugin is that data["dosconv"]
can actually be a function reference, and this is where the magic happens.
> Any ideas what I'm missing?
Here's the complete code for this plugin whipped up in two minutes :)
-------dospath2uri.py-------
# If $foo is a link that contains a \, use this plugin and
# use $dospath2uri('foo').
from Pyblosxom import tools
def conv(data):
data = str(data) # Just in case it's not a string
return data.replace('\\', '/')
def dospath2uri(var):
registry = tools.get_registry()
req = registry["request"]
data = req.getData()
conf = req.getConfiguration()
if data.has_key(var):
return conv(data[var])
elif conf.has_key(var):
return conv(conf[var])
else:
return ''
def cb_prepare(args):
request = args["request"]
data = request.getData()
data["dospath2uri"] = dospath2uri
----------------------------
--
Regards: Wari Wahab
RoughingIT - http://roughingit.subtlehints.net
PyBlosxom - http://roughingit.subtlehints.net/pyblosxom
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01