Cleanup after database use
This commit is contained in:
@@ -47,6 +47,7 @@ class ProfilePlugin(Plugin):
|
||||
for profile in profiles:
|
||||
temp.append(profile.to_dict(self.to_dict))
|
||||
|
||||
db.close()
|
||||
return temp
|
||||
|
||||
def save(self):
|
||||
@@ -83,6 +84,7 @@ class ProfilePlugin(Plugin):
|
||||
|
||||
profile_dict = p.to_dict(self.to_dict)
|
||||
|
||||
db.close()
|
||||
return jsonified({
|
||||
'success': True,
|
||||
'profile': profile_dict
|
||||
@@ -92,8 +94,10 @@ class ProfilePlugin(Plugin):
|
||||
|
||||
db = get_session()
|
||||
default = db.query(Profile).first()
|
||||
default_dict = default.to_dict(self.to_dict)
|
||||
db.close()
|
||||
|
||||
return default.to_dict(self.to_dict)
|
||||
return default_dict
|
||||
|
||||
def saveOrder(self):
|
||||
|
||||
@@ -109,6 +113,7 @@ class ProfilePlugin(Plugin):
|
||||
order += 1
|
||||
|
||||
db.commit()
|
||||
db.close()
|
||||
|
||||
return jsonified({
|
||||
'success': True
|
||||
@@ -133,6 +138,8 @@ class ProfilePlugin(Plugin):
|
||||
message = 'Failed deleting Profile: %s' % e
|
||||
log.error(message)
|
||||
|
||||
db.close()
|
||||
|
||||
return jsonified({
|
||||
'success': success,
|
||||
'message': message
|
||||
@@ -180,4 +187,5 @@ class ProfilePlugin(Plugin):
|
||||
|
||||
order += 1
|
||||
|
||||
db.close()
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user