Merge lp:~rvb/maas/bug-1062607 into lp:maas/trunk
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Raphaël Badin on 2012-10-08 | ||||
| Approved revision: | 1224 | ||||
| Merged at revision: | 1225 | ||||
| Proposed branch: | lp:~rvb/maas/bug-1062607 | ||||
| Merge into: | lp:maas/trunk | ||||
| Diff against target: |
77 lines (+47/-4) 2 files modified
src/maasserver/tests/test_views_settings_clusters.py (+36/-4) src/maasserver/urls.py (+11/-0) |
||||
| To merge this branch: | bzr merge lp:~rvb/maas/bug-1062607 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Jeroen T. Vermeulen (community) | 2012-10-08 | Approve on 2012-10-08 | |
|
Review via email:
|
|||
Commit Message
Cope with doubles slashes being removed by apache when editing an interface.
Description of the Change
This branch fixes the url machinery so that it will cope with the fact that apache transforms multiple slashes in a url into a single one. That pattern appears in the url that maas generates when one edits an interface with an empty name.
= Notes =
Maybe one can find a better way to express the fact that the new url matchers should match an empty interface "(?P<interface>
Note that I've tested in a production instance (behind apache), that this actually fixes bug 1062607.
| Gavin Panella (allenap) wrote : | # |
| Jeroen T. Vermeulen (jtv) wrote : | # |
I don't see how this can work: "(?P<interface>
I could be missing something, of course. But if not, this suggests a missing test.
| Raphaël Badin (rvb) wrote : | # |
> I don't see how this can work: "(?P<interface>
> string of length zero.
Indeed, that's exactly the intention, I want it to match 'interface' so that the view will be called with interface=''.
> If you want zero or more instances, that's actually
> easier: "(?P<interface>
Yeah, but the problem is the '/'.
Here is the url we have for the 'eth0' interface:
http://
Here is the url we have for the '' interface:
http://
The problem is that apache transforms it into
http://
That's the url that the new regex matches.
| Raphaël Badin (rvb) wrote : | # |
> Include a prefix, like "@" or "if=", then the regex can be
> "if=(?P<
That's actually a bit more complicated than the solution I have here I think. What I like about my solution is that is adds two completely new urls that we could remove once bug 1063881 is fixed and the new regex are easy to read.
| Jeroen T. Vermeulen (jtv) wrote : | # |
I think I see what you're saying now. But then why not just "(?P<interface>)" to get the empty string there?
| Raphaël Badin (rvb) wrote : | # |
> I think I see what you're saying now. But then why not just "(?P<interface>)"
> to get the empty string there?
Because that would match stuff like:
http://
And I don't want that :)
I just want to match:
http://
| Jeroen T. Vermeulen (jtv) wrote : | # |
I don't see what you mean... (?P<interface>) matches only the empty string, nothing else.
- 1224. By Raphaël Badin on 2012-10-08
-
Fix regexp.
| Raphaël Badin (rvb) wrote : | # |
> I don't see what you mean... (?P<interface>) matches only the empty string,
> nothing else.
Ah, you're right, I've updated the branch.


Include a prefix, like "@" or "if=", then the regex can be "if=(?P< interface> [\w\-]{ 0})" ?