changeset 166:7c0f3848f4a6

More bug fixing. We need to extend unit tests.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Fri, 04 Nov 2011 18:55:20 +0100
parents 4481820ee0f5
children 28debb8307a5
files src/ltpdarepo/views/browse.py
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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)