summaryrefslogtreecommitdiff
path: root/pgweb/util/middleware.py
diff options
context:
space:
mode:
authorMagnus Hagander2020-03-31 20:50:08 +0000
committerMagnus Hagander2020-03-31 20:55:13 +0000
commite02761dfcf0d41a2adca2085e826e405a724e977 (patch)
tree0693bb2586acecb8a89155519138528504fb32f4 /pgweb/util/middleware.py
parent5d7cf9833f27718733cbd805e86036eae24b86bc (diff)
Middleware and urls update for django 2.2
Diffstat (limited to 'pgweb/util/middleware.py')
-rw-r--r--pgweb/util/middleware.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pgweb/util/middleware.py b/pgweb/util/middleware.py
index a6d1dd91..06560173 100644
--- a/pgweb/util/middleware.py
+++ b/pgweb/util/middleware.py
@@ -22,15 +22,17 @@ def get_current_user():
# General middleware for all middleware functionality specific to the pgweb
# project.
class PgMiddleware(object):
- def process_view(self, request, view_func, view_args, view_kwargs):
- return None
+ def __init__(self, get_response):
+ self.get_response = get_response
- def process_request(self, request):
+ def __call__(self, request):
# Thread local store for username, see comment at the top of this file
_thread_locals.user = getattr(request, 'user', None)
initialize_template_collection()
- def process_response(self, request, response):
+ # Call the view
+ response = self.get_response(request)
+
# Set xkey representing the templates that are in use so we can do efficient
# varnish purging on commits.
tlist = get_all_templates()