Merge pull request #347 from Jaza/slash-url-suffix

re #343: Add slash before or after token in flask-security URLs correctly
This commit is contained in:
Matt Wright
2015-05-02 13:43:36 -04:00
2 changed files with 12 additions and 4 deletions
+8
View File
@@ -188,6 +188,14 @@ def get_url(endpoint_or_url):
return endpoint_or_url
def slash_url_suffix(url, suffix):
"""Adds a slash either to the beginning or the end of a suffix
(which is to be appended to a URL), depending on whether or not
the URL ends with a slash."""
return url.endswith('/') and ('%s/' % suffix) or ('/%s' % suffix)
def get_security_endpoint_name(endpoint):
return '%s.%s' % (_security.blueprint_name, endpoint)