From 52473505247731e74941eaf562fde2942a1aa7f4 Mon Sep 17 00:00:00 2001 From: James Turk Date: Wed, 28 Sep 2011 17:50:03 -0400 Subject: [PATCH] front page updates as it runs --- oyster/templates/index.html | 37 ++++++++++++++++++++++++++++++++--- oyster/templates/log_row.html | 1 - oyster/web.py | 4 +++- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/oyster/templates/index.html b/oyster/templates/index.html index c12dd2a..646479a 100644 --- a/oyster/templates/index.html +++ b/oyster/templates/index.html @@ -5,13 +5,44 @@ oyster {% endblock %} {% block body %} +

Stats

-
Queue Size
{{queue_size}}
-
Tracking
{{tracking}}
-
Need Update
{{need_update}}
+
Tracking
{{tracking}}
+
Need Update
{{need_update}}
Mongo Host
{{mongo_host}}
diff --git a/oyster/templates/log_row.html b/oyster/templates/log_row.html index 3300832..62639cc 100644 --- a/oyster/templates/log_row.html +++ b/oyster/templates/log_row.html @@ -1,4 +1,3 @@ - {{log.action}} {{log.url}} diff --git a/oyster/web.py b/oyster/web.py index 42c7c26..b41136e 100644 --- a/oyster/web.py +++ b/oyster/web.py @@ -19,6 +19,7 @@ class JSONEncoder(json.JSONEncoder): else: return super(JSONEncoder, self).default(obj) + def _path_fixer(url): """ this exists because werkzeug seems to collapse // into / sometimes certainly a hack, but given that werkzeug seems to only do the mangling @@ -26,6 +27,7 @@ def _path_fixer(url): """ return re.sub(r'(http|https|ftp):/([^/])', r'\1://\2', url) + def api_wrapper(template=None): def wrapper(func): @functools.wraps(func) @@ -50,7 +52,7 @@ def index(): status = { 'tracking': client.db.tracked.count(), 'need_update': client.get_update_queue_size(), - 'logs': client.db.logs.find().sort('$natural', -1).limit(20), + 'logs': list(client.db.logs.find().sort('$natural', -1).limit(20)), 'mongo_host': settings.MONGO_HOST, } return status