Template +edit and +admin forms should use referrer in next_url

Bug #522188 reported by Adi Roiban
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Low
Adi Roiban

Bug Description

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. I know that this behaviour has not changed in this branch. I do not
see any bugs that pertain to this surprise--maybe I do not know what to
search on. Here is an example of how to negotiate multiple origins:

    @property
    def next_url(self):
        referrer = self.request.getHeader('referer')
        if (referrer is not None
            and referrer.startswith(self.request.getApplicationURL())):
            return referrer
        else:
            return canonical_url(self.context)

Related branches

Adi Roiban (adiroiban)
Changed in rosetta:
assignee: nobody → Adi Roiban (adiroiban)
Adi Roiban (adiroiban)
Changed in rosetta:
status: New → In Progress
Changed in rosetta:
importance: Undecided → Low
Adi Roiban (adiroiban)
Changed in rosetta:
status: In Progress → Fix Committed
tags: added: qa-needstesting
Revision history for this message
Ursula Junque (ursinha) wrote : Bug fixed by a commit
Changed in rosetta:
milestone: none → 10.03
Adi Roiban (adiroiban)
tags: added: qa-bad
removed: qa-needstesting
Revision history for this message
Adi Roiban (adiroiban) wrote :

The referrer redirect is not working if product, series or sourcepackage name contains the template name.
This bug will also need unit tests.

Revision history for this message
Curtis Hovey (sinzui) wrote :

Edwin landed a redirect/next_url mixin that views can use. This bug may be fixable by switching to the mixin

Revision history for this message
Adi Roiban (adiroiban) wrote :

Thanks Curtis for this notice.

I have extended the ReturnToReferrerMixin mixin implemented by Edwin to handle the case when the form action can render the referrer url invalid.

Revision history for this message
Ursula Junque (ursinha) wrote :
tags: added: qa-needstesting
removed: qa-bad
Adi Roiban (adiroiban)
tags: added: qa-ok
removed: qa-needstesting
Revision history for this message
Curtis Hovey (sinzui) wrote : Bug 522188 Fix released

Fixed released in launchpad-project 10.03.

Changed in rosetta:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.