Page URI looks like this:
http://localhost/index?text=abc%20def%20ert&base=base1
Template xml looks like this:
<a> <n:attr name="href"><n:slot name="href" /></n:attr> <n:slot name="base" />(<n:slot name="count" />) </a>
Render code looks like this:
def render_href(self, ctx, data): u = url.URL.fromContext(ctx) u = u.replace("base", data[0]) ctx.fillSlots("href", u) ctx.fillSlots("base", data[0]) ctx.fillSlots("count", data[1]) return ctx.tag
Problem:
In this example, href of A-tag is not url-encoded. So, i have a link, that looks like this:
<a href="http://localhost/index?text=abc def ert&base=base2"> (there are spaces in href)
To make valid link, i need to do urllib.quote by myself:
from urllib import quote ctx.fillSlots("href", quote(str(u),':&/=?'))
Why URL flattener avoid urllib.quote?
P.S. And may be using urllib.unquote_plus() is more correct in url.URL than urllib.unquote()? (IE encoded form data spaces into '+' chars, not into '%20')
P.P.S. nevow 0.4.1