diff --git a/ckanext/datastore/plugin.py b/ckanext/datastore/plugin.py index aae4ee70d1f..a3a76f72936 100644 --- a/ckanext/datastore/plugin.py +++ b/ckanext/datastore/plugin.py @@ -273,6 +273,9 @@ def before_show(self, resource_dict): action='dump', resource_id=resource_dict['id']) connection = None + + resource_dict['datastore_active'] = False + try: connection = self.read_engine.connect() result = connection.execute( @@ -281,8 +284,6 @@ def before_show(self, resource_dict): ).fetchone() if result: resource_dict['datastore_active'] = True - else: - resource_dict['datastore_active'] = False finally: if connection: connection.close()