Add new Django and Python compatibility functions.
Review Request #10251 — Created Oct. 21, 2018 and submitted — Latest diff uploaded
The new
djblets.util.compat.django.shortcuts
module features a
version ofrender()
that works with older and newer versions of
Django. Any existing calls torender()
orrender_to_response()
should be updated to use this.The new
djblets.util.compat.django.utils.functional
provides a
backport ofSimpleLazyObject
, which supports more special functions
like__iter__
,__contains__
, and more. This is a drop-in replacement
for Django'sSimpleLazyObject
.The new
djblets.util.compat.python.past
is intended to provide
re-implementations of old useful capabilities that have been removed
from Python 3.x. For now, it providescmp
, which Python 3 has removed
in favor of a hard-to-remember comparison expression. For readability,
consistency, and easier development, our version can be used in place of
that expression.
Made use of this in some pending code. These worked on Python 2.7,
3.5, and 3.6.