# HG changeset patch # User Daniele Nicolodi # Date 1320429320 -3600 # Node ID 7c0f3848f4a69a1aceddbc0ce2b30f2be0fa58b2 # Parent 4481820ee0f58864d1139247928e32be33bbe367 More bug fixing. We need to extend unit tests. diff -r 4481820ee0f5 -r 7c0f3848f4a6 src/ltpdarepo/views/browse.py --- a/src/ltpdarepo/views/browse.py Fri Nov 04 12:57:06 2011 +0100 +++ b/src/ltpdarepo/views/browse.py Fri Nov 04 18:55:20 2011 +0100 @@ -480,31 +480,35 @@ t0 - INTERVAL toffset/1000 SECOND AS `reference time` FROM `%s`.tsdata WHERE obj_id=%%s""" % database, objid) details = curs.fetchone() - obj.update(details) + if details is not None: + 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, + curs.execute("""SELECT xunits, yunits FROM `%s`.xydata WHERE obj_id=%%s""" % database, objid) details = curs.fetchone() - obj.update(details) + if details is not None: + obj.update(details) fields += ('xunits', 'yunits', ) elif obj['data type'] == 'fsdata': curs = g.db.cursor(DictCursor) - curs.execute("""SELECT fs, xunits, yunits, + curs.execute("""SELECT fs, xunits, yunits FROM `%s`.fsdata WHERE obj_id=%%s""" % database, objid) details = curs.fetchone() - obj.update(details) + if details is not None: + obj.update(details) fields += ('fs', 'xunits', 'yunits', ) elif obj['data type'] == 'cdata': curs = g.db.cursor(DictCursor) - curs.execute("""SELECT yunits, + curs.execute("""SELECT yunits FROM `%s`.cdata WHERE obj_id=%%s""" % database, objid) details = curs.fetchone() - obj.update(details) + if details is not None: + obj.update(details) fields += ('yunits', ) return render_template('obj.html', obj=obj, database=db, fields=fields)