From 3956210a8bda550553bdb301a741d83f76475d2c Mon Sep 17 00:00:00 2001 From: xmo-odoo Date: Tue, 3 Mar 2015 17:02:33 +0100 Subject: [PATCH] [IMP] qweb doc: debugging directives fixes #4547 --- doc/reference/qweb.rst | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/doc/reference/qweb.rst b/doc/reference/qweb.rst index 30ef4c25196..81b3966a0fd 100644 --- a/doc/reference/qweb.rst +++ b/doc/reference/qweb.rst @@ -335,6 +335,17 @@ website's rich text edition. ``t-field-options`` can be used to customize fields, the most common option is ``widget``, other options are field- or widget-dependent. +debugging +--------- + +``t-debug`` + invokes a debugger using PDB's ``set_trace`` API. The parameter should + be the name of a module, on which a ``set_trace`` method is called:: + + + + is equivalent to ``importlib.import_module("pdb").set_trace()`` + Helpers ------- @@ -477,13 +488,30 @@ The javascript QWeb implementation provides a few debugging hooks: ``t-log`` takes an expression parameter, evaluates the expression during rendering - and logs its result with ``console.log`` + and logs its result with ``console.log``:: + + + + + will print ``42`` to the console ``t-debug`` - triggers a debugger breakpoint during template rendering + triggers a debugger breakpoint during template rendering:: + + + + + + will stop execution if debugging is active (exact condition depend on the + browser and its development tools) ``t-js`` the node's body is javascript code executed during template rendering. Takes a ``context`` parameter, which is the name under which the rendering - context will be available in the ``t-js``'s body + context will be available in the ``t-js``'s body:: + + + + console.log("Foo is", ctx.foo); + Helpers -------