Commit c698dbaf by Owo Sugiana

Bug fixed db lost connection

1 parent 5385b05b
...@@ -17,6 +17,7 @@ from pyramid.renderers import JSON ...@@ -17,6 +17,7 @@ from pyramid.renderers import JSON
from pyramid_mailer import mailer_factory_from_settings from pyramid_mailer import mailer_factory_from_settings
import datetime, decimal import datetime, decimal
from sqlalchemy import engine_from_config, or_ from sqlalchemy import engine_from_config, or_
import transaction
from .security import ( from .security import (
group_finder, group_finder,
get_user, MySecurityPolicy, get_user, MySecurityPolicy,
...@@ -167,7 +168,8 @@ def get_params(params, alternate=None, settings=None): ...@@ -167,7 +168,8 @@ def get_params(params, alternate=None, settings=None):
result = settings and params in settings and \ result = settings and params in settings and \
settings[params].strip() or None settings[params].strip() or None
if not result: if not result:
row = Parameter.query_kode(params).first() with transaction.manager:
row = Parameter.query_kode(params).first()
result = row and row.value or None result = row and row.value or None
return result and result or alternate return result and result or alternate
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!