diff options
author | Josh Blum | 2013-03-26 00:41:12 -0500 |
---|---|---|
committer | Josh Blum | 2013-03-26 00:41:12 -0500 |
commit | 38b24b7ef6e3d82c1a14b93c4ffafadbc2f1ae9b (patch) | |
tree | e33b921fb968ff14f260ee5b4afa254733ee37de /python/gras/stats/__init__.py | |
parent | a23b425c689ac66cd4d6e986b8a4292e19fc9710 (diff) | |
download | sandhi-38b24b7ef6e3d82c1a14b93c4ffafadbc2f1ae9b.tar.gz sandhi-38b24b7ef6e3d82c1a14b93c4ffafadbc2f1ae9b.tar.bz2 sandhi-38b24b7ef6e3d82c1a14b93c4ffafadbc2f1ae9b.zip |
gras: rename stats to query
Diffstat (limited to 'python/gras/stats/__init__.py')
-rw-r--r-- | python/gras/stats/__init__.py | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/python/gras/stats/__init__.py b/python/gras/stats/__init__.py deleted file mode 100644 index 330abd4..0000000 --- a/python/gras/stats/__init__.py +++ /dev/null @@ -1,52 +0,0 @@ -import time -import BaseHTTPServer - -import os -__path__ = os.path.abspath(os.path.dirname(__file__)) - -server_registry = dict() - -class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): - - def do_HEAD(s): - s.send_response(200) - s.send_header("Content-type", "text/html") - s.end_headers() - - def do_GET(s): - """Respond to a GET request.""" - if s.path.endswith('stats.xml'): - s.send_response(200) - s.send_header("Content-type", "text/xml") - s.end_headers() - s.wfile.write(server_registry[s.server].get_stats("")) - return - path = s.path - if path.startswith('/'): path = path[1:] - if not path: path = 'main.html' - target = os.path.join(__path__, path) - if os.path.exists(target): - s.send_response(200) - if target.endswith('.js'): s.send_header("Content-type", "text/javascript") - elif target.endswith('.css'): s.send_header("Content-type", "text/css") - else: s.send_header("Content-type", "text") - s.end_headers() - s.wfile.write(open(target).read()) - else: - s.send_response(404) - s.send_header("Content-type", "text/html") - s.end_headers() - s.wfile.write("<p>not found</p>") - -import select - -class http_server(object): - def __init__(self, args, top_block): - server_class = BaseHTTPServer.HTTPServer - self._httpd = server_class(args, MyHandler) - server_registry[self._httpd] = top_block - - def serve_forever(self): - while True: - try: self._httpd.serve_forever() - except select.error: pass |