Mercurial > public > sg101
comparison gcalendar/calendar.py @ 1028:5ba2508939f7
Django 1.8 changes; first batch.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 15 Dec 2015 21:01:07 -0600 |
parents | 4dc6a452afd3 |
children |
comparison
equal
deleted
inserted
replaced
1027:cd4db27c90e3 | 1028:5ba2508939f7 |
---|---|
7 import pytz | 7 import pytz |
8 | 8 |
9 import httplib2 | 9 import httplib2 |
10 from apiclient.discovery import build | 10 from apiclient.discovery import build |
11 from apiclient.http import BatchHttpRequest | 11 from apiclient.http import BatchHttpRequest |
12 from django.utils.tzinfo import FixedOffset | 12 from django.utils.timezone import get_fixed_timezone |
13 | 13 |
14 from gcalendar.models import Event | 14 from gcalendar.models import Event |
15 | 15 |
16 | 16 |
17 class CalendarError(Exception): | 17 class CalendarError(Exception): |
135 try: | 135 try: |
136 tz = pytz.timezone(tz_name) | 136 tz = pytz.timezone(tz_name) |
137 except pytz.UnknownTimeZoneError: | 137 except pytz.UnknownTimeZoneError: |
138 raise CalendarError('Invalid time zone: %s' % tz_name) | 138 raise CalendarError('Invalid time zone: %s' % tz_name) |
139 local = tz.localize(d) | 139 local = tz.localize(d) |
140 zulu = local.astimezone(FixedOffset(0)) | 140 zulu = local.astimezone(get_fixed_timezone(0)) |
141 s = zulu.strftime(self.DATE_TIME_TZ_FMT) | 141 s = zulu.strftime(self.DATE_TIME_TZ_FMT) |
142 | 142 |
143 return s | 143 return s |