20👍
✅
available_attrs()
only ever existed to help bridge between Python 2 and Python 3. This is documented in the Django 3.0 release notes:
Removed private Python 2 compatibility APIs
While Python 2 support was removed in Django 2.0, some private APIs weren’t removed from Django so that third party apps could continue using them until the Python 2 end-of-life.
Since we expect apps to drop Python 2 compatibility when adding support for Django 3.0, we’re removing these APIs at this time.
- […]
django.utils.decorators.available_attrs()
– This function returnsfunctools.WRAPPER_ASSIGNMENTS
If the @wraps()
in your sample line is the standard functools.wraps()
decorator, then you can just entirely remove assigned=available_attrs(...)
, because functools.WRAPPER_ASSIGNMENTS
is the default value for assigned
:
@wraps(view_func)
otherwise, just use functools.WRAPPER_ASSIGNMENTS
directly.
Source:stackexchange.com