Add new Django and Python compatibility functions.

Review Request #10251 — Created Oct. 21, 2018 and submitted — Latest diff uploaded

Information

Djblets
release-2.0.x
570294a...

Reviewers

The new djblets.util.compat.django.shortcuts module features a
version of render() that works with older and newer versions of
Django. Any existing calls to render() or render_to_response()
should be updated to use this.

The new djblets.util.compat.django.utils.functional provides a
backport of SimpleLazyObject, which supports more special functions
like __iter__, __contains__, and more. This is a drop-in replacement
for Django's SimpleLazyObject.

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 provides cmp, 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.

    Loading...