summaryrefslogtreecommitdiff
path: root/yaksh/middleware/user_time_zone.py
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-04-30 17:24:17 +0530
committerGitHub2020-04-30 17:24:17 +0530
commit2fd29bf1fff3d57a49b8a5cdffa9efc305946214 (patch)
tree16d974b5a5e1effaf15be2235813dca4108c4f29 /yaksh/middleware/user_time_zone.py
parent6fc01303dba0b821aa2344b761e98dc36b33807b (diff)
parent53a0c4ad3e733f3960000527f83565f2fd8fc412 (diff)
downloadonline_test-2fd29bf1fff3d57a49b8a5cdffa9efc305946214.tar.gz
online_test-2fd29bf1fff3d57a49b8a5cdffa9efc305946214.tar.bz2
online_test-2fd29bf1fff3d57a49b8a5cdffa9efc305946214.zip
Merge branch 'master' into API
Diffstat (limited to 'yaksh/middleware/user_time_zone.py')
-rw-r--r--yaksh/middleware/user_time_zone.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/yaksh/middleware/user_time_zone.py b/yaksh/middleware/user_time_zone.py
index 92035e8..8140851 100644
--- a/yaksh/middleware/user_time_zone.py
+++ b/yaksh/middleware/user_time_zone.py
@@ -12,12 +12,17 @@ class TimezoneMiddleware(object):
self.get_response = get_response
def __call__(self, request):
- return self.get_response(request)
-
- def process_request(self, request):
+ # Code to be executed for each request before
+ # the view (and later middleware) are called.
user = request.user
user_tz = 'Asia/Kolkata'
if hasattr(user, 'profile'):
if user.profile.timezone:
user_tz = user.profile.timezone
timezone.activate(pytz.timezone(user_tz))
+
+ response = self.get_response(request)
+
+ # Code to be executed for each request/response after
+ # the view is called.
+ return response