Skip to content

Fixed #22306 -- Deprecated future versions of cycle and firstof #2492

Closed
wants to merge 2 commits into from

2 participants

@maxocub
maxocub commented Mar 27, 2014

Deprecated future versions of cycle and firstof. Modified release notes and deprecation timeline. Removed usage of future versions of cycle and firstof by Django

@maxocub maxocub Fixed ticket #22306 -- Deprecated future versions of cycle and firstof
Modified release notes and deprecation timeline

Removed usage of future versions of cycle and firstof by Django
771cdc3
@timgraham timgraham commented on an outdated diff Mar 27, 2014
django/templatetags/future.py
-
- 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.8. Use the default `cycle` tag instead.",
@timgraham
Django member
timgraham added a note Mar 27, 2014

master is now Django 1.8 so we start the deprecation now and remove it in two release which will be Django 2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@timgraham timgraham commented on an outdated diff Mar 27, 2014
django/templatetags/future.py
@@ -27,52 +28,17 @@ def url(parser, token):
@register.tag
def cycle(parser, token):
- """
@timgraham
Django member
timgraham added a note Mar 27, 2014

You can leave this docstring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@timgraham timgraham commented on an outdated diff Mar 27, 2014
django/templatetags/future.py
return defaulttags.cycle(parser, token)
@register.tag
def firstof(parser, token):
- """
@timgraham
Django member
timgraham added a note Mar 27, 2014

As above, leave the docstring and change to deprecation to 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@timgraham timgraham commented on an outdated diff Mar 27, 2014
django/utils/deprecation.py
@@ -10,6 +10,10 @@ class RemovedInDjango19Warning(PendingDeprecationWarning):
pass
+class RemovedInDjango18Warning(DeprecationWarning):
@timgraham
Django member
timgraham added a note Mar 27, 2014

remove this and use RemovedInDjango20Warning instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@timgraham timgraham commented on an outdated diff Mar 27, 2014
docs/internals/deprecation.txt
@@ -152,9 +152,8 @@ details on these changes.
Upgrade paths are described in the :ref:`transaction management docs
<transactions-upgrading-from-1.5>`.
-* The :ttag:`cycle` and :ttag:`firstof` template tags will auto-escape their
- arguments. In 1.6 and 1.7, this behavior is provided by the version of these
- tags in the ``future`` template tag library.
+* ``cycle`` and ``firstof`` template tags will be removed from the ``future``
@timgraham
Django member
timgraham added a note Mar 27, 2014

this goes under 2.0 and don't remove the cycle/firstof stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@timgraham timgraham commented on an outdated diff Mar 27, 2014
docs/releases/1.6.txt
@@ -1002,33 +1002,14 @@ You're strongly encouraged to use the most recent version of PostgreSQL
available, because of performance improvements and to take advantage of the
native streaming replication available in PostgreSQL 9.x.
-Changes to :ttag:`cycle` and :ttag:`firstof`
@timgraham
Django member
timgraham added a note Mar 27, 2014

This goes in the 1.8 release notes and don't change this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@timgraham timgraham commented on an outdated diff Mar 27, 2014
docs/releases/1.6.txt
-
-The tags implementing the old behavior have been deprecated, and in Django
-1.8, the old behavior will be replaced with the new behavior. To ensure
-compatibility with future versions of Django, existing templates should be
-modified to use the ``future`` versions.
-
-If necessary, you can temporarily disable auto-escaping with
-:func:`~django.utils.safestring.mark_safe` or :ttag:`{% autoescape off %}
-<autoescape>`.
+Loading ``cycle`` and ``firstof`` template tags from ``future`` library
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Django 1.6 introduced ``{% load cycle from future %}`` and
+``{% load firstof from future %}`` syntax for forward compatibility of the
+:ttag:`cycle` and :ttag:`firstof` template tags. This syntax is now deprecated
+and will be removed in Django 1.8. You can simply remove the
@timgraham
Django member
timgraham added a note Mar 27, 2014

2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@timgraham
Django member

Please see the commit message guidelines if you haven't, and remove "ticket" in the message.

Thanks for doing this. With a few changes as noted above this should be good to go.

@maxocub
maxocub commented Mar 27, 2014

Thank you for the fast reply! I wasn't sure about the version timeline, I should have asked. I'll make those changes real soon.

@timgraham
Django member

Also, you should add your name to AUTHORS and fill out a CLA: https://www.djangoproject.com/foundation/cla/

@maxocub maxocub changed the title from Fixed ticket #22306 -- Deprecated future versions of cycle and firstof to Fixed #22306 -- Deprecated future versions of cycle and firstof Mar 28, 2014
@maxocub maxocub Made changes asked in review by timgraham
- Fixed errors with version numbers
facd3a9
@maxocub
maxocub commented Mar 28, 2014

I sent my individual CLA yesterday, and I'll send a corporate one next week since I'll contribute as part of my job, but I don't understand how to specify which contributions are individual or corporate...

@timgraham
Django member

I don't think it's important -- if you submit both that should be sufficient.

@timgraham
Django member

merged in 5e4e0b6, thanks!

@timgraham timgraham closed this Mar 28, 2014
@maxocub maxocub deleted the unknown repository branch Mar 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.