launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #04388
Re: Best way to fix canonical_url
On Aug 18, 2010, at 4:03 PM, Guilherme Salgado wrote:
> On Thu, 2010-08-19 at 07:25 +1200, Tim Penhey wrote:
>> On Thu, 19 Aug 2010 07:08:30 Francis J. Lacoste wrote:
>>> Hi,
>>>
>>> I agree with Salgado, I don't think removing that checks is the right
>>> solution.
>>>
>>> And I don't really think there is a problem either. create_view and
>>> create_initialized_view have a layer parameter. Why don't you use that
>>> parametere?
>>
>> 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.
>>
>> If that is on a bug page, then the current request implements the BugLayer.
>> With my new restrictive change, the +edit view isn't defined for the BugLayer,
>> so it blows up.
>>
>> This is the guts of the problem, not the unit tests.
>
> I see. In that case, I'd be in favour of your second idea, or maybe
> even a simple mapping of rootsites to layers. Mostly because even
> though the view check in canonical_url() is not doing the correct thing,
> it still catches 404 links.
Your second idea sounds fine.
I was hoping there was already some easy reasonable path to get what you need, but yeah, I dug around, and I don't see one.
Adding the info to allvhosts would fit into one structure we have already. That's the most attractive thing I see from my perspective. (I'd be tempted to make the allvhosts data structure become utility registrations eventually, but that's another discussion.)
Gary
References