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: Avoid overzealous exception catching Created Sept. 23, 2015, 1:54 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..78c6c8f1a0fba63c0457848e9bd2a68ca83f8c22 100644
--- a/cms/bin/test_server.py
+++ b/cms/bin/test_server.py
@@ -101,6 +101,16 @@ 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
Sebastian Noack 2015/09/29 11:45:30 I'm not too happy with this change. I don't think
+ dynamic_handler = get_handler(path)
+ except (KeyError, ImportError):
+ pass
+ else:
+ return dynamic_handler(environ, start_response)
+
+ # 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