changeset 128:1944c8ad80cb

Add missing permission check.
author Daniele Nicolodi <daniele@grinta.net>
date Fri, 14 Oct 2011 10:34:47 +0200
parents 83e915192078
children 5bf7dc63466d
files src/ltpdarepo/views/browse.py
diffstat 1 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/views/browse.py	Fri Oct 14 10:34:47 2011 +0200
+++ b/src/ltpdarepo/views/browse.py	Fri Oct 14 10:34:47 2011 +0200
@@ -558,26 +558,27 @@
 @app.route('/<database>/timeseries')
 @require('user')
 def timeseries(database):
-    db = Database.load(database)
-    if db is None:
-        # not found
-        abort(404)
+    with view('database', database):
+        db = Database.load(database)
+        if db is None:
+            # not found
+            abort(404)
 
-    # applicable search criteria
-    indexes = Indexes(database, Timeseries.columns)
+        # applicable search criteria
+        indexes = Indexes(database, Timeseries.columns)
 
-    # parse reuest
-    r = Request(request.args, Timeseries.columns, indexes)
-    t = Timerange(request.args)
+        # parse reuest
+        r = Request(request.args, Timeseries.columns, indexes)
+        t = Timerange(request.args)
 
-    # collect objects
-    count = Timeseries(database).filter(*r.query).timespan(*t.range).count()
-    batch = Pagination(r.page, size=PAGESIZE, count=count)
-    objs  = Timeseries(database).filter(*r.query).timespan(*t.range).orderby(*r.order).limit(*batch.limits).all()
+        # collect objects
+        count = Timeseries(database).filter(*r.query).timespan(*t.range).count()
+        batch = Pagination(r.page, size=PAGESIZE, count=count)
+        objs  = Timeseries(database).filter(*r.query).timespan(*t.range).orderby(*r.order).limit(*batch.limits).all()
 
-    return render_template('timerange.html', objs=objs, batch=batch,
-                           fields=TIMESERIESFIELDS, database=db,
-                           indexes=indexes, query=r.criteria, timerange=t)
+        return render_template('timerange.html', objs=objs, batch=batch,
+                               fields=TIMESERIESFIELDS, database=db,
+                               indexes=indexes, query=r.criteria, timerange=t)
 
 
 module = app