Merge lp:~syleam/openobject-server/trunk-interactive_mode into lp:openobject-server
Status: | Rejected |
---|---|
Rejected by: | Vo Minh Thu |
Proposed branch: | lp:~syleam/openobject-server/trunk-interactive_mode |
Merge into: | lp:openobject-server |
Diff against target: |
75 lines (+22/-4) 2 files modified
openerp-server (+18/-2) openerp/tools/config.py (+4/-2) |
To merge this branch: | bzr merge lp:~syleam/openobject-server/trunk-interactive_mode |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+92148@code.launchpad.net |
Description of the change
Add two command line arguments for openerp-server :
"--execute=
"--interactive" : Turns on python interactive console just after server initialization.
These two arguments can be used together. The interactive console is activated after script execution, so we can use a script to initialize some variables for interactive use.
Using one or both of them implies --stop-after-init : Services are not initialized, to allows using these modes without stopping a running instance, and the process stops when we quit the interactive console or when the script ends if interactive console was not started.
If the "--database" argument is supplied, a database is loaded (only the first is used for comma separated list of databases names) and some variables are initialized :
- db : Connection to the database.
- pool : Pooler on the database.
- cr : Cursor on the database. Automatically closed at end of execution, but no commit is done. You have to commit manually if needed.
- uid : integer 1 (admin user's id).
Unmerged revisions
- 4020. By Sylvain Garancher
-
[IMP] Add '--execute' and '--interactive' command line arguments
I don't want to add feature the `openerp-server` anymore. The startup script is already difficult to read and future-proof.
Instead I prefer you create your own startup script. If you want to share it, you can propose a similar feature in the openerp-command project: https:/ /launchpad. net/openerp- command. It is not yet officially supported but was done to accept things like this one.
That being said, I think I would prefer to make your 'execute' option the other way around: instead of passing a script to be executed, the script is importing the `openerp` library and do whatever it wants (and thus be no longer an option).