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

Delta Between Two Patch Sets: multiplexer.py

Issue 8327353: Crawler backend (Closed)
Left Patch Set: README fix Created Sept. 14, 2012, 2:42 p.m.
Right Patch Set: Created Sept. 27, 2012, 2:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | sitescripts/crashes/__init__.py » ('j') | sitescripts/web.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding: utf-8 2 # coding: utf-8
3 3
4 # This Source Code is subject to the terms of the Mozilla Public License 4 # This Source Code is subject to the terms of the Mozilla Public License
5 # version 2.0 (the "License"). You can obtain a copy of the License at 5 # version 2.0 (the "License"). You can obtain a copy of the License at
6 # http://mozilla.org/MPL/2.0/. 6 # http://mozilla.org/MPL/2.0/.
7 7
8 import flask 8 import flask
9 from sitescripts.web import handlers 9 from sitescripts.web import handlers
10 from urlparse import urlparse 10 from urlparse import urlparse
11 11
12 app = flask.Flask(__name__) 12 app = flask.Flask(__name__)
13 13
14 @app.route("/<path:path>", methods = ["GET", "POST"]) 14 @app.route("/<path:path>", methods = ["GET", "POST"])
15 def multiplex(path): 15 def multiplex(path):
16 request_url = urlparse(flask.request.url) 16 request_url = urlparse(flask.request.url)
17 request_path = request_url.path 17 request_path = request_url.path
18 if request_path in handlers: 18 if request_path in handlers:
19 if 'SERVER_ADDR' not in flask.request.environ: 19 if 'SERVER_ADDR' not in flask.request.environ:
20 flask.request.environ['SERVER_ADDR'] = flask.request.environ['SERVER_NAME' ] 20 flask.request.environ['SERVER_ADDR'] = flask.request.environ['SERVER_NAME' ]
21 return handlers[request_path] 21 return handlers[request_path]
22 return flask.abort(404) 22 return flask.abort(404)
23 23
24 if __name__ == "__main__": 24 if __name__ == "__main__":
25 app.run(debug=True) 25 app.run(debug=True)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld