Skip to content

Commit

Permalink
fail gracefully if no dbname is given
Browse files Browse the repository at this point in the history
  • Loading branch information
lepistone committed Jun 23, 2016
1 parent d7043f1 commit b7097f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion anthem/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,13 @@ def __exit__(self, exc_type, exc_value, traceback):

def _build_odoo_env(self, odoo_args):
openerp.tools.config.parse_config(odoo_args)
openerp.service.server.start(preload=[], stop=True)
dbname = openerp.tools.config['db_name']
if not dbname:
argparse.ArgumentParser().error(
"please provide a database name though Odoo options (either "
"-d or an Odoo configuration file)"
)
openerp.service.server.start(preload=[], stop=True)

registry = openerp.modules.registry.RegistryManager.get(dbname)
cr = registry.cursor()
Expand Down

0 comments on commit b7097f6

Please sign in to comment.