web/lib/django/contrib/auth/__init__.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
--- a/web/lib/django/contrib/auth/__init__.py	Wed May 19 17:43:59 2010 +0200
+++ b/web/lib/django/contrib/auth/__init__.py	Tue May 25 02:43:45 2010 +0200
@@ -1,4 +1,5 @@
 import datetime
+from warnings import warn
 from django.core.exceptions import ImproperlyConfigured
 from django.utils.importlib import import_module
 
@@ -12,13 +13,25 @@
     try:
         mod = import_module(module)
     except ImportError, e:
-        raise ImproperlyConfigured, 'Error importing authentication backend %s: "%s"' % (module, e)
+        raise ImproperlyConfigured('Error importing authentication backend %s: "%s"' % (module, e))
     except ValueError, e:
-        raise ImproperlyConfigured, 'Error importing authentication backends. Is AUTHENTICATION_BACKENDS a correctly defined list or tuple?'
+        raise ImproperlyConfigured('Error importing authentication backends. Is AUTHENTICATION_BACKENDS a correctly defined list or tuple?')
     try:
         cls = getattr(mod, attr)
     except AttributeError:
-        raise ImproperlyConfigured, 'Module "%s" does not define a "%s" authentication backend' % (module, attr)
+        raise ImproperlyConfigured('Module "%s" does not define a "%s" authentication backend' % (module, attr))
+    try:
+        getattr(cls, 'supports_object_permissions')
+    except AttributeError:
+        warn("Authentication backends without a `supports_object_permissions` attribute are deprecated. Please define it in %s." % cls,
+             PendingDeprecationWarning)
+        cls.supports_object_permissions = False
+    try:
+        getattr(cls, 'supports_anonymous_user')
+    except AttributeError:
+        warn("Authentication backends without a `supports_anonymous_user` attribute are deprecated. Please define it in %s." % cls,
+             PendingDeprecationWarning)
+        cls.supports_anonymous_user = False
     return cls()
 
 def get_backends():