Commit 962110061d8d7515d0e86b70eec2e12afd159d2a
1 parent
71b461d3
Exists in
master
and in
39 other branches
avoiding valuerror on fixed offset
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
src/tz/middleware.py
| ... | ... | @@ -10,11 +10,11 @@ class TimezoneMiddleware(object): |
| 10 | 10 | |
| 11 | 11 | try: |
| 12 | 12 | offset = int(offset) * -1 |
| 13 | + tz = pytz.FixedOffset(offset) | |
| 13 | 14 | except ValueError: |
| 14 | 15 | offset = 0 |
| 15 | 16 | |
| 16 | 17 | if offset: |
| 17 | - tz = pytz.FixedOffset(offset) | |
| 18 | 18 | timezone.activate(tz) |
| 19 | 19 | else: |
| 20 | 20 | timezone.deactivate() | ... | ... |