Skip to content

Commit

Permalink
Merge pull request #3366 from ckan/3366-tolerate-missing-system-info
Browse files Browse the repository at this point in the history
Tolerate missing system_info table
  • Loading branch information
TkTech committed Dec 30, 2016
2 parents ccb8dd5 + 29f67ef commit 613c094
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ckan/model/system_info.py
Expand Up @@ -53,11 +53,15 @@ def __init__(self, key, value):

def get_system_info(key, default=None):
''' get data from system_info table '''
obj = meta.Session.query(SystemInfo).filter_by(key=key).first()
if obj:
return obj.value
else:
return default
from sqlalchemy.exc import ProgrammingError
try:
obj = meta.Session.query(SystemInfo).filter_by(key=key).first()
if obj:
return obj.value
except ProgrammingError:
meta.Session.rollback()
return default



def delete_system_info(key, default=None):
Expand Down

0 comments on commit 613c094

Please sign in to comment.