diff options
author | Alton MacDonald <alton.kenneth.macdonald@fokus.fraunhofer.de> | 2013-12-11 11:52:28 +0100 |
---|---|---|
committer | Alton MacDonald <alton.kenneth.macdonald@fokus.fraunhofer.de> | 2013-12-11 11:52:28 +0100 |
commit | c512fd826427e508a8735a9b54cc770fa09a5368 (patch) | |
tree | 59397c655d6cfae388e49bde86ec4f2ca151c340 /hlr_mgmt/views.py | |
parent | 51f696bf9ab1a2b061d48ef644480efa96e4158d (diff) |
added error exceptions for DB locking and added third state to BTS notification
Diffstat (limited to 'hlr_mgmt/views.py')
-rw-r--r-- | hlr_mgmt/views.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/hlr_mgmt/views.py b/hlr_mgmt/views.py index 98ff47a..50f0ef0 100644 --- a/hlr_mgmt/views.py +++ b/hlr_mgmt/views.py @@ -52,11 +52,14 @@ def connect_sgsn(settings): return sgsn def db_execute(db, sql_string, params=None): - if params==None: - rs = db.execute(sql_string) - else: - rs = db.execute(sql_string, params) - db.commit() + try: + if params==None: + rs = db.execute(sql_string) + else: + rs = db.execute(sql_string, params) + db.commit() + except sqlite3.OperationalError: + rs = [] return rs def db_query(db, sql_string, params=None): @@ -240,6 +243,7 @@ def bts_view(request): bts[i]['timeslots'] = collections.defaultdict() bts[i]['stats'] = bsc.get_bts_info(str(i)) bts[i]['description'] = bts[i]['stats'][1].split(": ")[1].strip() + bts[i]['oml_state'] = (bts[i]['stats'][15].split(": ")[1] == "connected.") for j in range(0,8): helper = bsc.get_timeslot_info(str(i), str(j)) bts[i]['timeslots'][j] = helper[0].replace("cfg","cfg:") + "," + helper[1] |