summaryrefslogtreecommitdiff
path: root/yaksh/middleware/user_time_zone.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-07-09 00:01:14 -0500
committerGitHub2016-07-09 00:01:14 -0500
commitf1f9818a397a954acf3bce134ea278fafca81a08 (patch)
treedb3e2e92cd836b072fe3c3e51d2dc4568a9eddc8 /yaksh/middleware/user_time_zone.py
parent41b4b7607d8ea6856a8b397d4c9e5bb9edea0b77 (diff)
parent9b66d99965fc8b01b5817159636dcb99e5808ef1 (diff)
downloadonline_test-f1f9818a397a954acf3bce134ea278fafca81a08.tar.gz
online_test-f1f9818a397a954acf3bce134ea278fafca81a08.tar.bz2
online_test-f1f9818a397a954acf3bce134ea278fafca81a08.zip
Merge pull request #112 from prathamesh920/oauth-implementation
oauth implemented
Diffstat (limited to 'yaksh/middleware/user_time_zone.py')
-rw-r--r--yaksh/middleware/user_time_zone.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/yaksh/middleware/user_time_zone.py b/yaksh/middleware/user_time_zone.py
index f1aace9..0bd4831 100644
--- a/yaksh/middleware/user_time_zone.py
+++ b/yaksh/middleware/user_time_zone.py
@@ -8,8 +8,8 @@ class TimezoneMiddleware(object):
if user timezone is not available default value 'UTC' is activated """
def process_request(self, request):
user = request.user
+ user_tz = 'UTC'
if hasattr(user, 'profile'):
- user_tz = user.profile.timezone
- timezone.activate(pytz.timezone(user_tz))
- else:
- timezone.activate(pytz.timezone('UTC'))
+ if user.profile.timezone:
+ user_tz = user.profile.timezone
+ timezone.activate(pytz.timezone(user_tz))