Esempio n. 1
0
def firstof(parser, token):
    """
    This is the future version of `firstof` with auto-escaping.

    This is equivalent to:

       {% if var1 %}
           {{ var1 }}
       {% elif var2 %}
           {{ var2 }}
       {% elif var3 %}
           {{ var3 }}
       {% endif %}

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

        {% autoescape off %}
            {% firstof var1 var2 var3 "<strong>fallback value</strong>" %}
        {% autoescape %}

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

        {% firstof var1 var2|safe var3 "<strong>fallback value</strong>"|safe %}

    """
    return defaulttags.firstof(parser, token, escape=True)
Esempio n. 2
0
def firstof(parser, token):
    """
    This is the future version of `firstof` with auto-escaping.
    The deprecation is now complete and this version is no different
    from the non-future version so this is deprecated.

    This is equivalent to::

        {% if var1 %}
            {{ var1 }}
        {% elif var2 %}
            {{ var2 }}
        {% elif var3 %}
            {{ var3 }}
        {% endif %}

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

        {% autoescape off %}
            {% firstof var1 var2 var3 "<strong>fallback value</strong>" %}
        {% autoescape %}

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

        {% firstof var1 var2|safe var3 "<strong>fallback value</strong>"|safe %}

    """
    warnings.warn(
        "Loading the `firstof` tag from the `future` library is deprecated and "
        "will be removed in Django 2.0. Use the default `firstof` tag instead.",
        RemovedInDjango20Warning)
    return defaulttags.firstof(parser, token)
Esempio n. 3
0
def firstof(parser, token):
    """
    This is the future version of `firstof` with auto-escaping.
    The deprecation is now complete and this version is no different
    from the non-future version so this is deprecated.

    This is equivalent to::

        {% if var1 %}
            {{ var1 }}
        {% elif var2 %}
            {{ var2 }}
        {% elif var3 %}
            {{ var3 }}
        {% endif %}

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

        {% autoescape off %}
            {% firstof var1 var2 var3 "<strong>fallback value</strong>" %}
        {% autoescape %}

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

        {% firstof var1 var2|safe var3 "<strong>fallback value</strong>"|safe %}

    """
    warnings.warn(
        "Loading the `firstof` tag from the `future` library is deprecated and "
        "will be removed in Django 1.10. Use the default `firstof` tag instead.",
        RemovedInDjango110Warning)
    return defaulttags.firstof(parser, token)
Esempio n. 4
0
def firstof(parser, token):
    """
    This is the future version of `firstof` 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)

    This is equivalent to::

        {% if var1 %}
            {{ var1 }}
        {% elif var2 %}
            {{ var2 }}
        {% elif var3 %}
            {{ var3 }}
        {% endif %}

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

        {% autoescape off %}
            {% firstof var1 var2 var3 "<strong>fallback value</strong>" %}
        {% autoescape %}

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

        {% firstof var1 var2|safe var3 "<strong>fallback value</strong>"|safe %}

    """
    return defaulttags.firstof(parser, token)
Esempio n. 5
0
def firstof(parser, token):
    """
    This is the future version of `firstof` with auto-escaping.
    The deprecation is now complete and this version is no different
    from the non-future version so this is deprecated.

    This is equivalent to::

        {% if var1 %}
            {{ var1 }}
        {% elif var2 %}
            {{ var2 }}
        {% elif var3 %}
            {{ var3 }}
        {% endif %}

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

        {% autoescape off %}
            {% firstof var1 var2 var3 "<strong>fallback value</strong>" %}
        {% autoescape %}

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

        {% firstof var1 var2|safe var3 "<strong>fallback value</strong>"|safe %}

    """
    return defaulttags.firstof(parser, token)
Esempio n. 6
0
import warnings