summaryrefslogtreecommitdiff
path: root/yaksh/middleware
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/middleware')
-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))