summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
Diffstat (limited to 'doc/reference')
-rw-r--r--doc/reference/qweb.rst34
1 files 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::
+
+ <t t-debug="pdb"/>
+
+ 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``::
+
+ <t t-set="foo" t-value="42"/>
+ <t t-log="foo"/>
+
+ will print ``42`` to the console
``t-debug``
- triggers a debugger breakpoint during template rendering
+ triggers a debugger breakpoint during template rendering::
+
+ <t t-if="a_test">
+ <t t-debug="">
+ </t>
+
+ 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::
+
+ <t t-set="foo" t-value="42"/>
+ <t t-js="ctx">
+ console.log("Foo is", ctx.foo);
+ </t>
Helpers
-------