diff --git a/djangosaml2/backends.py b/djangosaml2/backends.py index d1c0140..d8b5e3d 100644 --- a/djangosaml2/backends.py +++ b/djangosaml2/backends.py @@ -322,6 +322,7 @@ def get_attribute_value(self, django_field, attributes, attribute_mapping): warnings.warn( "get_attribute_value() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning, + stacklevel=2, ) return self._get_attribute_value(django_field, attributes, attribute_mapping) @@ -329,6 +330,7 @@ def get_django_user_main_attribute(self): warnings.warn( "get_django_user_main_attribute() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning, + stacklevel=2, ) return self._user_lookup_attribute @@ -336,6 +338,7 @@ def get_django_user_main_attribute_lookup(self): warnings.warn( "get_django_user_main_attribute_lookup() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning, + stacklevel=2, ) return getattr(settings, "SAML_DJANGO_USER_MAIN_ATTRIBUTE_LOOKUP", "") @@ -343,6 +346,7 @@ def get_user_query_args(self, main_attribute): warnings.warn( "get_user_query_args() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning, + stacklevel=2, ) return { self.get_django_user_main_attribute() @@ -353,6 +357,7 @@ def configure_user(self, user, attributes, attribute_mapping): warnings.warn( "configure_user() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning, + stacklevel=2, ) return self._update_user(user, attributes, attribute_mapping) @@ -360,6 +365,7 @@ def update_user(self, user, attributes, attribute_mapping, force_save=False): warnings.warn( "update_user() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning, + stacklevel=2, ) return self._update_user(user, attributes, attribute_mapping) @@ -367,6 +373,7 @@ def _set_attribute(self, obj, attr, value): warnings.warn( "_set_attribute() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning, + stacklevel=2, ) return set_attribute(obj, attr, value) @@ -375,5 +382,6 @@ def get_saml_user_model(): warnings.warn( "_set_attribute() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning, + stacklevel=2, ) return Saml2Backend()._user_model