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

Unified Diff: cms/bin/test_server.py

Issue 29328527: Issue 3112 - Support use of sitescripts URL handlers from the test server (Closed)
Patch Set: Created Sept. 23, 2015, 1:24 p.m.
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 | « README.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/bin/test_server.py
diff --git a/cms/bin/test_server.py b/cms/bin/test_server.py
index aa39fc49de6ea209ea4e2f58326edc16706825ee..0d5593e30b329bc89aff4ea595fe6a434f908982 100644
--- a/cms/bin/test_server.py
+++ b/cms/bin/test_server.py
@@ -101,6 +101,14 @@ def show_error(start_response, status, **kwargs):
def handler(environ, start_response):
path = environ.get("PATH_INFO")
+ # First check for a relevant URL handler in sitescripts
+ try:
+ from sitescripts.web import get_handler
+ return get_handler(path)(environ, start_response)
+ except (KeyError, ImportError):
+ pass
+
+ # Otherwise serve a static file / page
data = get_data(path)
if data is None:
return show_error(start_response, "404 Not Found", uri=path)
« no previous file with comments | « README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld