1. huang jw
  2. hotdebug

Wiki

Clone wiki

hotdebug / Home

Hotdebug

A simple Openerp module to add 'online' debug function, means you can run a console inside the openerp-server

when it is running. Useful for developers.

!!!Note that it is only useful for developing, not for production. Since it can easily crash your server, by simply:

    os._exit(0)

have fun :)

Install

Suppose openerp-server is installed at /usr/share/pyshared/openerp-server

    $ cd /usr/share/pyshared/openerp-server/addons
    $ hg clone https://bitbucket.org/jayven/hotdebug hotdebug

Then goto the client and install the module in Administration->Modules.

After that, a new menu item should appear at Administration->Hot Debug.

This module does not create any new database tables.

Usage

Console

Use the console just like a common python interactive shell and press 'save' (or ctrl+S) to send command to the shell.

Note: since Openerp strip spaces of the input, so you need some tricks sometimes. For example:

Console 01 Console 02 Console 03 Console 04

Predefined variables in the console:

NameValue Meaning
dbnameCurrent database's name
crCurrent database's cursor. Most db function need this variable as the first argument
uidCurrent user's id. Most db function need this variable as the second argument
poolObject pool. Common usage to get an object: pool.get('res.country')

Last exception

This tab shows the last exception caught, either from the console or from other modules (there are buttons to turn these feature on/off).

It is useful when you're debugging module that throw uncaught exception and don't know the traceback.

Also tracebacks can be export/import now.

Note: If there is an uncaught exception thrown from other modules, one need to press 'Refresh' button to display it since Openerp does not 'push event' to client.

Profile

Require the package pstats: apt-get install python-profiler

Useful to find out which part (functions) take the most of time.

Note: during profiling, the server will become quite slow so be patience.

Updated