Code review comment for lp:~bjornt/launchpad/bug-376990

Revision history for this message
Björn Tillenius (bjornt) wrote :

This branch makes canonical_url() produce browser URLs, even though the
current request is a web service request. We have some problems that API
URLs are used instead of browser URLs, for example in XHTML.
presentations and when e-mail notifications are generated inside API.
methods.

IMHO, canonical_url() should be split into two functions, but it's too.
late to do that now. I'd like one function that always returns a browser
URL, and one that returns either a browser or web service URL, depending
on which request is currently used. That's basically how I made.
canonical_url() work with this change. If no request is explicitly.
passed to it, a browser URL is always returned. In the case where you.
may want an API URL, you have to pass in the current request explicitly.
That's why I had to pass in the request to canonical_url() in the.
/people/foo rediretor, since it's used in both the app and web service
servers. Basically all code that redirects objects to canonical_url().
will need to pass in the request explicitly. At the moment all tests.
pass, but we might find a few bugs later. I don't expect this to be a.
big deal, though.

In this branch I also made canonical_url.txt run in FunctionalLayer, so
that it runs a bit faster.

BTW, I'm not going to land this branch before someone with more web.
service foo has commented on it, but I have discussed this approach with.
them already.

« Back to merge proposal