templatetags Package¶
splangotags Module¶
Bases:
django.template.base.NodeTemplate 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.TemplateSyntaxErrorif'request'is not incontext, or if the former does not have an experiments manager.
Bases:
django.template.base.NodeTemplate 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_variantis the enrolled variant.Parameters: context ( django.template.context.Context) – template contextReturns: node_listrendered or an empty stringReturn type: basestring Raises: django.template.TemplateSyntaxErrorif the experiment namedexp_namehas not been declared yet
Return a
ExperimentNodeaccording 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.TemplateSyntaxErrorif tag arguments intokenare different than three
Return a
HypNodeaccording 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.TemplateSyntaxErrorif tag arguments intokenare different than two