launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #04358
Re: Best way to fix canonical_url
On Thu, 2010-08-19 at 07:25 +1200, Tim Penhey wrote:
> It isn't just in unit tests, but in page tests too.
>
> the TALES expression branch/fmt:link/+edit
>
> gets converted to:
> canonical_url(branch, view_name="+edit")
>
> And we do use that type of TALES expression all over the place.
I think you can pass the vhost (not layer) to the tales formatter. This
branch/fmt:link:code/+edit
Menu links do not honour this rule. The menu made the link using the
__launchpad_facet__ on the view, even if you are using a facet menu that
implies the links are on the facet's host and should use its layer.
From the doc test:
The link can make the URL go to a specific app.
>>> login(ANONYMOUS,
... LaunchpadTestRequest(SERVER_URL='http://code.launchpad.net'))
>>> print test_tales("pillar/fmt:link:translations", pillar=ubuntu)
<a ...http://translations.launchpad.dev/ubuntu...
>>> print test_tales("person/fmt:url:feeds", person=mark)
http://feeds.launchpad.dev/~mark
>>> print test_tales("bug/fmt:url:mainsite", bug=bug)
http://launchpad.dev/bugs/1
--
__Curtis C. Hovey_________
http://launchpad.net/
Attachment:
signature.asc
Description: This is a digitally signed message part
Follow ups
References