templatetags Package¶
splangotags
Module¶
Bases:
django.template.base.Node
Template node for the {% experiment ... %} template tag.
This
render()
returns an empty string (thus{% experiment "..." variants "...,...,..." %}
renders nothing) but it must be called so that the experiment is recorded appropriately.Declare the experiment and enroll a variant. Render nothing.
Parameters: context ( django.template.context.Context
) – template contextReturns: empty string Return type: basestring Raises: django.template.TemplateSyntaxError
if'request'
is not incontext
, or if the former does not have an experiments manager.
Bases:
django.template.base.Node
Template node for a
{% hyp %}
template tag.This
render()
method of this class either returns an empty string or the inner nodes rendered.Render the node list if
exp_variant
is the enrolled variant.Parameters: context ( django.template.context.Context
) – template contextReturns: node_list
rendered or an empty stringReturn type: basestring Raises: django.template.TemplateSyntaxError
if the experiment namedexp_name
has not been declared yet
Return a
ExperimentNode
according to the contents oftoken
.- Example::
- {% experiment “signup_button” variants “red,blue” %}
Parameters: - parser – template parser object, not used
- token (
django.template.base.Token
) – tag contents i.e. between{% `` and `` %}
Returns: experiment node
Return type: Raises: django.template.TemplateSyntaxError
if tag arguments intoken
are different than three
Return a
HypNode
according to the contents oftoken
.- Example::
- {% hyp “signup_button” “blue” %}
Parameters: - parser (
django.template.base.Parser
) – template parser object - token (
django.template.base.Token
) – tag contents i.e. between{% `` and `` %}
Returns: experiment node
Return type: Raises: django.template.TemplateSyntaxError
if tag arguments intoken
are different than two