summaryrefslogtreecommitdiff
path: root/lib/python2.7/site-packages/django/contrib/auth/handlers/modwsgi.py
diff options
context:
space:
mode:
authorcoderick142017-05-17 15:40:18 +0530
committercoderick142017-05-17 15:41:00 +0530
commitfe407193c200e03070928c1e2c1a6e067d32893d (patch)
tree1c492aa814754b5db5d644c769f5382306217298 /lib/python2.7/site-packages/django/contrib/auth/handlers/modwsgi.py
parent9a1393e8470d855762e699abca9911b9cdae6a7d (diff)
downloadSBHS-2018-Rpi-fe407193c200e03070928c1e2c1a6e067d32893d.tar.gz
SBHS-2018-Rpi-fe407193c200e03070928c1e2c1a6e067d32893d.tar.bz2
SBHS-2018-Rpi-fe407193c200e03070928c1e2c1a6e067d32893d.zip
Upgrade to Django 1.11
- Database integration yet to be tested
Diffstat (limited to 'lib/python2.7/site-packages/django/contrib/auth/handlers/modwsgi.py')
-rw-r--r--lib/python2.7/site-packages/django/contrib/auth/handlers/modwsgi.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/lib/python2.7/site-packages/django/contrib/auth/handlers/modwsgi.py b/lib/python2.7/site-packages/django/contrib/auth/handlers/modwsgi.py
deleted file mode 100644
index f14afcf..0000000
--- a/lib/python2.7/site-packages/django/contrib/auth/handlers/modwsgi.py
+++ /dev/null
@@ -1,47 +0,0 @@
-from django.contrib import auth
-from django import db
-from django.utils.encoding import force_bytes
-
-
-def check_password(environ, username, password):
- """
- Authenticates against Django's auth database
-
- mod_wsgi docs specify None, True, False as return value depending
- on whether the user exists and authenticates.
- """
-
- UserModel = auth.get_user_model()
- # db connection state is managed similarly to the wsgi handler
- # as mod_wsgi may call these functions outside of a request/response cycle
- db.reset_queries()
-
- try:
- try:
- user = UserModel._default_manager.get_by_natural_key(username)
- except UserModel.DoesNotExist:
- return None
- if not user.is_active:
- return None
- return user.check_password(password)
- finally:
- db.close_old_connections()
-
-def groups_for_user(environ, username):
- """
- Authorizes a user based on groups
- """
-
- UserModel = auth.get_user_model()
- db.reset_queries()
-
- try:
- try:
- user = UserModel._default_manager.get_by_natural_key(username)
- except UserModel.DoesNotExist:
- return []
- if not user.is_active:
- return []
- return [force_bytes(group.name) for group in user.groups.all()]
- finally:
- db.close_old_connections()