Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
add a hash to redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Hammel committed Jun 7, 2011
1 parent d380d36 commit bf041c9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions toolbox/handlers.py
Expand Up @@ -81,8 +81,10 @@ def link(self, path=None):
return string + path


def redirect(self, location, query=None):
return exc.HTTPSeeOther(location=quote(location) + (query and self.query_string(query) or ''))
def redirect(self, location, query=None, anchor=None):
return exc.HTTPSeeOther(location=quote(location)
+ (query and self.query_string(query) or '')
+ (anchor and ('#' + anchor) or ''))

def query_string(self, query):
"""
Expand Down Expand Up @@ -415,7 +417,7 @@ def Post(self):
value = self.request.POST[key]
self.app.model.rename_field_value(field, key, value)

return self.redirect('/' + field + '#' + value)
return self.redirect('/' + field, anchor=value)

def get_json(self):
return self.data['values']
Expand Down

0 comments on commit bf041c9

Please sign in to comment.