# HG changeset patch # User Daniele Nicolodi # Date 1320401502 -3600 # Node ID d1f0cfc4da0f4d788c3bc4c05fbde9a0a6ba65f6 # Parent 8bd23369e429a9fb3eea4e2ae99b95ff40ca2265 Show extended object properties from 'ao' and '{ts,fs,xy,c}data' tables in object view. diff -r 8bd23369e429 -r d1f0cfc4da0f src/ltpdarepo/views/browse.py --- a/src/ltpdarepo/views/browse.py Fri Nov 04 11:11:41 2011 +0100 +++ b/src/ltpdarepo/views/browse.py Fri Nov 04 11:11:42 2011 +0100 @@ -441,7 +441,52 @@ if obj is None: # not found abort(404) - return render_template('obj.html', obj=obj, database=db, fields=FIELDS+EXTRA) + + fields = FIELDS + EXTRA + + if obj['type'] == 'ao': + curs = g.db.cursor(DictCursor) + curs.execute("""SELECT data_type AS `data type`, + description AS `description` + FROM `%s`.ao WHERE obj_id=%%s""" % database, objid) + fields += ('data type', 'data description', ) + details = curs.fetchone() + obj.update(details) + + if obj['data type'] == 'tsdata': + curs = g.db.cursor(DictCursor) + curs.execute("""SELECT t0, nsecs, fs, xunits, yunits, + t0 - INTERVAL toffset/1000 SECOND AS `reference time` + FROM `%s`.tsdata WHERE obj_id=%%s""" % database, objid) + details = curs.fetchone() + obj.update(details) + fields += ('reference time', 't0', 'nsecs', 'fs', 'xunits', 'yunits', ) + + elif obj['data type'] == 'xydata': + curs = g.db.cursor(DictCursor) + curs.execute("""SELECT xunits, yunits, + FROM `%s`.xydata WHERE obj_id=%%s""" % database, objid) + details = curs.fetchone() + obj.update(details) + fields += ('xunits', 'yunits', ) + + elif obj['data type'] == 'fsdata': + curs = g.db.cursor(DictCursor) + curs.execute("""SELECT fs, xunits, yunits, + FROM `%s`.fsdata WHERE obj_id=%%s""" % database, objid) + details = curs.fetchone() + obj.update(details) + fields += ('fs', 'xunits', 'yunits', ) + + elif obj['data type'] == 'cdata': + curs = g.db.cursor(DictCursor) + curs.execute("""SELECT yunits, + FROM `%s`.cdata WHERE obj_id=%%s""" % database, objid) + details = curs.fetchone() + obj.update(details) + fields += ('yunits', ) + + return render_template('obj.html', obj=obj, database=db, fields=fields) @app.route('///')