Re: First example of the showmore plugin

Wari Wahab <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
Chris Moffitt wrote:

> Seriously, though it works fine - except for one small thing. I'm running
> into the dospath issue again. The more link doesn't work - it's got
> slashes going the wrong way! 

Damn it, that's what you get when doing things in a proper OS and then 
run it in a broken one :)

> I don't know either how to use dospath2uri
> in conjunction with another plugin (is it possible - even if it is, it
> gets kludgy). 

Heheh, interesting that it would work.

> Obviously I can modify the plugin to work by doing a simple
> substitution on the slashes but I want to make sure that makes the most
> sense. What do you think?

Try this:
import urllib # at the beginning, then

    # At the line that says:
    output = '<a href="%s/%s">%s</a>' % \
            (conf['base_url'], entry['file_path'], var)

    # Change to
    output = '<a href="%s/%s">%s</a>' % \
            (conf['base_url'],
             urllib.pathname2url(entry['file_path']), var)

If that doesn't work, then use the kludgy way:
entry['file_path'].sub(os.sep, '/') #or something like that.

I don't have a windows box with python installed to know if pathname2url 
works or not, if it does, you can even modify the dospath2uri plugin to 
use it as well.



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
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.