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)
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)
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)
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)
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)
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)
import warnings
def cycle(parser, token): if django.VERSION < (1, 8): return defaulttags.cycle(parser, token, escape=True) else: return defaulttags.cycle(parser, token)