Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/web.py

Issue 29328589: Issue 3122 - Add testpages.web.sitekey_frame URL handler (Closed)
Patch Set: Further improvements Created Oct. 8, 2015, noon
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sitescripts/utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/web.py
diff --git a/sitescripts/web.py b/sitescripts/web.py
index dc4509b22a295b660d9e357e0f4ea64e773e3519..c0bfd577955e13d51956b7eeab62cdc251513355 100644
--- a/sitescripts/web.py
+++ b/sitescripts/web.py
@@ -20,6 +20,7 @@ import imp
import importlib
import re
import httplib
+import urllib
from urlparse import parse_qsl
from sitescripts.utils import get_config
@@ -38,6 +39,15 @@ def registerUrlHandler(url, func):
raise Exception('A handler for url %s is already registered' % url)
handlers[url] = func
+# https://www.python.org/dev/peps/pep-0333/#url-reconstruction
kzar 2015/10/08 12:06:37 I realised this function should probably live in s
+def request_path(environ, include_query=True):
+ path = urllib.quote(environ.get("SCRIPT_NAME", "") +
+ environ.get("PATH_INFO", ""))
+ query_string = environ.get("QUERY_STRING", "")
+ if query_string and include_query:
+ path += "?" + urllib.quote(query_string)
+ return path
+
def basic_auth(config_section = "DEFAULT"):
def decorator(function):
def authenticating_wrapper(environ, start_response):
« no previous file with comments | « sitescripts/utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld