Ticket #127 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

__after__ isn't called during redirects (HTTPExceptions raised)

Reported by: novalis Owned by: pjenvey
Priority: normal Milestone: 0.9.3
Component: dispatch/routing Version: svn
Severity: normal Keywords:
Cc:

Description

Paste needs a redirect_to class method for request. This will be useful for Pylons, because unlike the Pylons redirect_to, it doesn't operate via exceptions. This is good if you want your after method to be called after a redirect.

Pylons should wrap WSGIRequest to allow it accept url_for style arguments. This can't be in paste because paste doesn't know about routes.

Attached are patches which implement these.

Attachments

paste-response-redirect-to.patch (0.7 KB) - added by novalis 3 years ago.
pylons-response-redirect-to.patch (1.2 KB) - added by novalis 3 years ago.

Change History

Changed 3 years ago by novalis

Changed 3 years ago by novalis

comment:1 Changed 3 years ago by pjenvey

  • owner changed from thejimmyg to pjenvey
  • status changed from new to assigned
  • summary changed from Non-exception version of redirect_to to __after__ isn't called during redirects (HTTPExceptions raised)
  • milestone set to 0.9.3

I think a better way to fix after during redirects and the like would be to catch HTTPExceptions, call after, then re-raise

comment:2 Changed 3 years ago by pjenvey

  • status changed from assigned to closed
  • resolution set to fixed

(In [1477]) ensuring after is called after actions raise HTTPExceptions (e.g. redirect_to). after won't be called (nor will the action, obviously) in the rare case before triggers an HTTPException fixes #127 (thanks David Turner)

comment:3 Changed 3 years ago by novalis

I actually think the new Response.redirect_to is useful on its own, because it allows the response to be manipulated (for instance, to set a header).

Note: See TracTickets for help on using tickets.


Powered by Pylons - Contact Administrators