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

Side by Side Diff: run_tests.py

Issue 4827963358969856: Issue 147 - [Typed objects] Implement object types (Closed)
Patch Set: Fixed comments and one more issue Created April 22, 2014, 3:10 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/typedObjects/utils.js ('k') | test/common.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # coding: utf-8
3
4 # This file is part of Adblock Plus <http://adblockplus.org/>,
5 # Copyright (C) 2006-2014 Eyeo GmbH
6 #
7 # Adblock Plus is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 3 as
9 # published by the Free Software Foundation.
10 #
11 # Adblock Plus is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
18
19 import flask
20 import os
21 import re
22 from urlparse import urlparse
23
24 app = flask.Flask(__name__)
25
26 def js_encode(str):
27 return re.sub(r"(['\\])", r"\\\1", str)
28
29 @app.route("/<path:path>", methods = ["GET"])
30 @app.route("/", methods = ["GET"])
31 def multiplex(path=""):
32 request_url = urlparse(flask.request.url)
33 request_path = request_url.path
34 if request_path.startswith("/lib/"):
35 path = flask.safe_join(os.path.dirname(__file__), request_path.lstrip("/"))
36 if not os.path.isfile(path):
37 return flask.abort(404)
38
39 with open(path, "rb") as file:
40 module = os.path.splitext(request_path[len("/lib/"):])[0]
41 data = "require.scopes['%s'] = function(){exports={};%s\nreturn exports;}( );" % (module, file.read())
42 return (data, 200, {"Content-Type": "application/javascript; charset=utf-8 "})
43 else:
44 if request_path.endswith("/"):
45 request_path += "index.html"
46 return flask.send_from_directory(os.path.join(os.path.dirname(__file__), "te st"), request_path.lstrip("/"))
47
48 if __name__ == "__main__":
49 app.run(debug=True)
OLDNEW
« no previous file with comments | « lib/typedObjects/utils.js ('k') | test/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld