Cleanup after database use

This commit is contained in:
Ruud
2012-05-07 21:55:18 +02:00
parent 7a6576e407
commit 7ca509cdbe
16 changed files with 78 additions and 28 deletions
+6 -1
View File
@@ -65,6 +65,7 @@ class CoreNotifier(Notification):
q.update({Notif.read: True})
db.commit()
db.close()
return jsonified({
'success': True
@@ -90,6 +91,7 @@ class CoreNotifier(Notification):
ndict['type'] = 'notification'
notifications.append(ndict)
db.close()
return jsonified({
'success': True,
'empty': len(notifications) == 0,
@@ -114,7 +116,8 @@ class CoreNotifier(Notification):
ndict['time'] = time.time()
self.messages.append(ndict)
db.remove()
db.close()
return True
def frontend(self, type = 'notification', data = {}):
self.messages.append({
@@ -143,6 +146,8 @@ class CoreNotifier(Notification):
ndict['type'] = 'notification'
messages.append(ndict)
db.close()
self.messages = []
return jsonified({
'success': True,
@@ -22,3 +22,6 @@ class History(Notification):
)
db.add(history)
db.commit()
db.close()
return True