Ejemplo n.º 1
0
def sanecycle(*args, **kwargs):
    """
    {% cycle 1 2 3 a myvar %} => ""
    {{ myvar }} => 1
    {{ myvar }} => 2
    {{ myvar }} => 3
    {{ myvar }} => 1
    """
    realnode = cycle(*args, **kwargs)
    return SaneCycleNode(realnode)
Ejemplo n.º 2
0
def cycle(parser, token):
    """
    This is the future version of `cycle` with auto-escaping.

    By default all strings are escaped.

    If you want to disable auto-escaping of variables you can use:

        {% autoescape off %}
            {% cycle var1 var2 var3 as somecycle %}
        {% autoescape %}

    Or if only some variables should be escaped, you can use:

        {% cycle var1 var2|safe var3|safe  as somecycle %}
    """
    return defaulttags.cycle(parser, token, escape=True)
Ejemplo n.º 3
0
def cycle(parser, token):
    """
    This is the future version of `cycle` with auto-escaping.
    The deprecation is now complete and this version is no different
    from the non-future version so this can be deprecated (#22306)

    By default all strings are escaped.

    If you want to disable auto-escaping of variables you can use::

        {% autoescape off %}
            {% cycle var1 var2 var3 as somecycle %}
        {% autoescape %}

    Or if only some variables should be escaped, you can use::

        {% cycle var1 var2|safe var3|safe  as somecycle %}
    """
    return defaulttags.cycle(parser, token)
Ejemplo n.º 4
0
def cycle(parser, token):
    """
    This is the future version of `cycle` with auto-escaping.
    The deprecation is now complete and this version is no different
    from the non-future version so this is deprecated.

    By default all strings are escaped.

    If you want to disable auto-escaping of variables you can use::

        {% autoescape off %}
            {% cycle var1 var2 var3 as somecycle %}
        {% autoescape %}

    Or if only some variables should be escaped, you can use::

        {% cycle var1 var2|safe var3|safe  as somecycle %}
    """
    return defaulttags.cycle(parser, token)
Ejemplo n.º 5
0
def cycle(parser, token):
    """
    This is the future version of `cycle` with auto-escaping.
    The deprecation is now complete and this version is no different
    from the non-future version so this is deprecated.

    By default all strings are escaped.

    If you want to disable auto-escaping of variables you can use::

        {% autoescape off %}
            {% cycle var1 var2 var3 as somecycle %}
        {% autoescape %}

    Or if only some variables should be escaped, you can use::

        {% cycle var1 var2|safe var3|safe  as somecycle %}
    """
    warnings.warn(
        "Loading the `cycle` tag from the `future` library is deprecated and "
        "will be removed in Django 2.0. Use the default `cycle` tag instead.",
        RemovedInDjango20Warning)
    return defaulttags.cycle(parser, token)
Ejemplo n.º 6
0
def cycle(parser, token):
    """
    This is the future version of `cycle` with auto-escaping.
    The deprecation is now complete and this version is no different
    from the non-future version so this is deprecated.

    By default all strings are escaped.

    If you want to disable auto-escaping of variables you can use::

        {% autoescape off %}
            {% cycle var1 var2 var3 as somecycle %}
        {% autoescape %}

    Or if only some variables should be escaped, you can use::

        {% cycle var1 var2|safe var3|safe  as somecycle %}
    """
    warnings.warn(
        "Loading the `cycle` tag from the `future` library is deprecated and "
        "will be removed in Django 1.10. Use the default `cycle` tag instead.",
        RemovedInDjango110Warning)
    return defaulttags.cycle(parser, token)
Ejemplo n.º 7
0
import warnings
Ejemplo n.º 8
0
def cycle(parser, token):
    if django.VERSION < (1, 8):
        return defaulttags.cycle(parser, token, escape=True)
    else:
        return defaulttags.cycle(parser, token)
Ejemplo n.º 9
0
def cycle(parser, token):
    if django.VERSION < (1, 8):
        return defaulttags.cycle(parser, token, escape=True)
    else:
        return defaulttags.cycle(parser, token)