Skip to content

Commit

Permalink
Better checks: in debug mode only a critical exception if write permi…
Browse files Browse the repository at this point in the history
…ssions on read-only db.
  • Loading branch information
domoritz committed Sep 28, 2012
1 parent 0d97d5e commit eca6c28
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ckanext/datastore/plugin.py
Expand Up @@ -51,7 +51,7 @@ def configure(self, config):
# so that no harmful queries can be made
if not ('debug' in config and config['debug']):
self._check_separate_db()
self._check_read_permissions()
self._check_read_permissions()

self._create_alias_table()
else:
Expand Down Expand Up @@ -155,7 +155,10 @@ def _check_read_permissions(self):
raise
else:
log.info("Connection url {0}".format(self.read_url))
raise Exception("We have write permissions on the read-only database.")
if 'debug' in self.config and self.config['debug']:
log.critical("We have write permissions on the read-only database.")
else:
raise Exception("We have write permissions on the read-only database.")
finally:
read_trans.rollback()
except Exception:
Expand Down

0 comments on commit eca6c28

Please sign in to comment.