Merge lp:~adiroiban/launchpad/bug-522188 into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Graham Binns on 2010-03-11 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | not available |
| Proposed branch: | lp:~adiroiban/launchpad/bug-522188 |
| Merge into: | lp:launchpad |
| Diff against target: |
140 lines (+87/-6) 4 files modified
lib/lp/app/templates/generic-edit-next-url.pt (+19/-0) lib/lp/translations/browser/configure.zcml (+2/-2) lib/lp/translations/browser/potemplate.py (+33/-2) lib/lp/translations/stories/standalone/xx-potemplate-edit.txt (+33/-2) |
| To merge this branch: | bzr merge lp:~adiroiban/launchpad/bug-522188 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Graham Binns (community) | code | 2010-02-16 | Approve on 2010-03-11 |
|
Review via email:
|
|||
| Adi Roiban (adiroiban) wrote : | # |
| Graham Binns (gmb) wrote : | # |
Hi Adi,
Good branch; I'll run this through ec2 for you.
Approved revision: 10317.
| Adi Roiban (adiroiban) wrote : | # |
Hi Graham,
I had to use another generic-edit template as some views were not compatible with the previous implementation of generic-edit.
Also, since the POTemplate admin page can rename the template name, I had to implement this dirty hack in order to avoid redirecting to a page that is no longer available.
I asked Curtis, and he agree that this is not a clean solution but he also said the code is correct and he is not aware of any other better solution.
Any suggestion is much appreciated.
Can you please review the changes?
Here is the new diff.
=== added file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -0,0 +1,19 @@
+<html
+ xmlns="http://
+ xmlns:tal="http://
+ xmlns:metal="http://
+ xmlns:i18n="http://
+ metal:use-
+ i18n:domain=
+ <body>
+ <div metal:fill-
+ <div metal:use-
+ <div metal:fill-
+ <input type="hidden" name="next_url"
+ tal:condition=
+ tal:attributes=
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -7,13 +7,7 @@
i18n:
<body>
<div metal:fill-
- <div metal:use-
- <div metal:fill-
- <input type="hidden" name="next_url"
- tal:condition=
- tal:attributes=
- </div>
- </div>
+ <div metal:use-
</div>
</body>
</html>
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -414,14 +414,14 @@
- template=
+ template=
- template=
+ template=
| Graham Binns (gmb) wrote : | # |
Hi Adi,
That's a horrible, horrible hack, but Curtis is right; the code's fine, we just need a better way of dealing with it.
I'll give this r=me, but before I do please file a bug about that XXX and refer to it in the XXX comment (e.g. XXX AdiRoiban 2010-02-23 bug=yyyyyy...).
| Adi Roiban (adiroiban) wrote : | # |
Hi,
Reported bug 526998, and pushed the changes.
I have tested the previous failing tests and everything was fine.
When you have time, can you please try again to land it again.
Thanks!
| Adi Roiban (adiroiban) wrote : | # |
Hi,
I fix the problem causing the potemplate-admin test to fail.
When you have time, please take a look at this diff and tell me if there is anything I need to do to have this branch landed.
Many thanks!
Here is the diff.
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -550,10 +550,19 @@
# The referer header we want is only available before the view's
# form submits to itself. This field is a hidden input in the form.
referrer = self.request.
+
if referrer is None:
+ # If we don't have a referrer in the HTTP header, if referrer
+ # contains the template name or if referrer is outside of our
+ # website, getting the next_url is delayed until the
+ # form is submitted.
+ # It is not computed before the submission, since from this form
+ # the template name can be changed and if referrer url depends on
+ # it, renaming will make the referrer an invalid URL.
if (referrer is None
- or self.context.name in referrer):
+ or self.context.name in referrer
+ or not referrer.

= Bug 522188 =
In the merge review for bug 340664, Curtis noted that the next_url for potemplate edit and admin forms is not using the referer address.
Below are his comments:
The behaviour of these actions is disconcerting. When I edit a a template,
the next_url is the template, but I expected to return to the all templates
view.
== Proposed fix ==
Use HTTP_REFERER in cancel_url and next_url
== Pre-implementation notes ==
In the merge review for bug 340664 Curtis suggested using HTTP_REFERER for cancel_url and next_url.
== Implementation details ==
Since the template edit and admin form are using the generic edit template, I have added the extra_info fill-slot there.
Please let me know if I should create a new template.
Since this looks like a generic behaviour, maybe we can have this implementation in LaunchpadForm and not in each class extending LaunchpadForm
== Tests ==
lp-test -t template-edit
== Demo and Q/A ==
Login as admin
1. Visit a series templates page: ie: https:/ /translations. launchpad. dev/evolution/ trunk/+ templates
Click 'Edit' or 'Admin' link for a template.
On the form page, click Update or Cancel, it should lead you back to the templates page.
2. Directly access the edit page at https:/ /translations. launchpad. dev/evolution/ trunk/+ pots/evolution- 2.2-test/ +edit
Click Update or Cancel. It should lead you to the template index page. ie https:/ /translations. launchpad. dev/evolution/ trunk/+ pots/evolution- 2.2-test
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: app/templates/ generic- edit.pt translations/ browser/ potemplate. py translations/ stories/ standalone/ xx-potemplate- edit.txt
lib/lp/
lib/lp/
lib/lp/