diff options
| author | xmo-odoo <xmo-odoo@users.noreply.github.com> | 2015-03-03 17:02:33 +0100 |
|---|---|---|
| committer | xmo-odoo <xmo-odoo@users.noreply.github.com> | 2015-03-03 17:02:33 +0100 |
| commit | 3956210a8bda550553bdb301a741d83f76475d2c (patch) | |
| tree | 1683e458deb95de75d980a298bf876eae8c21ab7 /doc/reference | |
| parent | 1155099d2ba25423213b3fff035dd7cb8e0414d8 (diff) | |
[IMP] qweb doc: debugging directives
fixes #4547
Diffstat (limited to 'doc/reference')
| -rw-r--r-- | doc/reference/qweb.rst | 34 |
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 ------- |
