Skip to content

Instantly share code, notes, and snippets.

@leorochael
Last active April 20, 2016 19:13
Show Gist options
  • Save leorochael/888f1a728b227676244c to your computer and use it in GitHub Desktop.
Save leorochael/888f1a728b227676244c to your computer and use it in GitHub Desktop.
Using IPython with anybox.recipe.odoo
[buildout]
parts = odoo
find-links = http://download.gna.org/pychart/
[odoo]
version = git http://github.com/odoo/odoo.git odoo 8.0 depth=1
recipe = anybox.recipe.odoo:server
eggs =
nose
ipython
bpython
openerp_scripts =
nosetests=nosetests command-line-options=-d
ipython command-line-options=-d arguments=user_ns=dict(session=session)
bpython command-line-options=-d arguments=locals_=dict(session=session)
@leorochael
Copy link
Author

The Session object that is used in openerp_scripts expects that its switches be separated from the switches for the underlying script (i.e. nosetests or ipython) by --.

This means that, in order to actually pass the -d switch for selecting the database, you need invoke, say, ipython_odoo generated by the buildout above like:

ipython_odoo -d mydatabase --

Otherwise the Session will try to open the database specified by db_name in <buildout:dir>/etc/odoo.cfg (i.e. generated by the options.db_name parameter to anybox.recipe.odoo:server), defaulting to the database named after the current user.

And IPython itself will complain that it doesn't know a -d switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment