Server debugging flags. They may be combined using binary operators.
no debug information
rql execution information
executed sql
repository events
multi-sources
hooks
operations
more verbosity
all level enabled
To debug your RQL statements, it can be useful to enable a verbose output:
from cubicweb import server
server.set_debug(server.DBG_RQL|server.DBG_SQL|server.DBG_ALL)
change the repository debugging mode
Another example showing how to debug hooks at a specific code site:
from cubicweb.server import debuged, DBG_HOOKS
with debugged(DBG_HOOKS):
person.cw_set(works_for=company)
See Profiling and performance chapter (see Profiling and performance).
Context manager and decorator to help debug the repository.
It can be used either as a context manager:
>>> with debugged('DBG_RQL | DBG_REPO'):
... # some code in which you want to debug repository activity,
... # seing information about RQL being executed an repository events.
or as a function decorator:
>>> @debugged('DBG_RQL | DBG_REPO')
... def some_function():
... # some code in which you want to debug repository activity,
... # seing information about RQL being executed an repository events
The debug mode will be reset to its original value when leaving the “with” block or the decorated function.