Jump to >

This documentation covers the in-development release of Djblets. You can see the latest stable docs or all previous versions.

djblets.deprecation

Internal support for handling deprecations in Djblets.

The version-specific objects in this module are not considered stable between releases, and may be removed at any point. The base objects are considered stable.

exception BaseRemovedInDjbletsVersionWarning[source]

Base class for a Djblets deprecation warning.

All version-specific deprecation warnings inherit from this, allowing callers to check for Djblets deprecations without being tied to a specific version.

classmethod warn(message, stacklevel=2)[source]

Emit the deprecation warning.

This is a convenience function that emits a deprecation warning using this class, with a suitable default stack level. Callers can provide a useful message and a custom stack level.

New in version 3.0.

Parameters
  • message (str) – The message to show in the deprecation warning.

  • stacklevel (int, optional) – The stack level for the warning.

exception RemovedInDjblets40Warning[source]

Deprecations for features scheduled for removal in Djblets 4.0.

Note that this class will itself be removed in Djblets 4.0. If you need to check against Djblets deprecation warnings, please see BaseRemovedInDjbletsVersionWarning. Alternatively, you can use the alias for this class, RemovedInNextDjbletsVersionWarning.

exception RemovedInDjblets50Warning[source]

Deprecations for features scheduled for removal in Djblets 5.0.

Note that this class will itself be removed in Djblets 5.0. If you need to check against Djblets deprecation warnings, please see BaseRemovedInDjbletsVersionWarning. Alternatively, you can use the alias for this class, RemovedInNextDjbletsVersionWarning.

RemovedInNextDjbletsVersionWarning[source]

An alias for the next release of Djblets where features would be removed.

deprecated_arg_value(owner_name, value, old_arg_name, new_arg_name=None, warning_cls=<class 'DeprecationWarning'>)[source]

Wrap a value in a lazy object to warn when used.

Parameters
  • owner_name (unicode) – The name of the owner of this argument.

  • value (object) – The argument value.

  • old_arg_name (unicode) – The name of the argument that was deprecated.

  • new_arg_name (unicode, optional) – The optional name of the argument to use in the deprecated argument’s place, if one is available.

  • warning_cls (type, optional) – The class to use for the warning. This should be DeprecationWarning, PendingDeprecationWarning, or a subclass of one.

Returns

The value wrapped in a lazy object. The first time it is accessed, a warning will be emitted.

Return type

django.utils.functional.SimpleLazyObject