On 22 Oct 2012, at 9:28 AM, David Sorrentino <[email protected]> wrote:
> I have got some doubts about the use of anchor links and the URL rewriting by
> means of routes.py.
>
> This is my routes.py:
>
> routes_out = (
> ('/myapp/default/$f', '/$f')
> )
>
> So /myapp/default/just_a_page is rewritten in output like /just_a_page . This
> works.
>
> The problem raises when I specify an anchor link in my view, for instance:
> {{=URL(f='just_a_page', anchor="just_an_anchor")}}
>
> Indeed in this case routes.py does not rewrite the URL, since
> /myapp/default/just_a_page#just_an_anchor does not match
> with/myapp/default/$f (understandably).
>
> So, how could I set up routes.py so that it will rewrite URLs containing
> anchors?
>
> Thank you in advance for your help.
Can you use the parametric router? It should handle anchors properly.
Alternatively, try something like:
routes_out = (
('/myapp/default/$f', '/$f')
('/myapp/default/$f/$anything', '/$f/$anything')
)
--