Skip to content

Commit 32937a6

Browse files
author
api.jscudder
committed
Added URL parameter to query object to request time information about an event in a specific timezone. Resolves issue 48.
1 parent 15ef880 commit 32937a6

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/gdata/calendar/service.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,19 @@ def _SetRecurrenceExpansionEnd(self, val):
539539
_SetRecurrenceExpansionEnd,
540540
doc="""The recurrence-expansion-end query parameter""")
541541

542+
def _SetTimezone(self, val):
543+
self['ctz'] = val
544+
545+
def _GetTimezone(self):
546+
if 'ctz' in self.keys():
547+
return self['ctz']
548+
else:
549+
return None
550+
551+
ctz = property(_GetTimezone, _SetTimezone,
552+
doc="""The ctz query parameter which sets report time on the server.""")
553+
554+
542555
class CalendarListQuery(gdata.service.Query):
543556
"""Queries the Google Calendar meta feed"""
544557

tests/gdata_tests/calendar/service_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ def testSortOrderValidatesValues(self):
310310
except gdata.calendar.service.Error:
311311
self.assertEquals(self.query.sortorder, 'a')
312312

313+
def testTimezoneParameter(self):
314+
self.query.ctz = 'America/Los_Angeles'
315+
self.assertEquals(self.query['ctz'], 'America/Los_Angeles')
316+
self.assert_(self.query.ToUri().find('America%2FLos_Angeles') > -1)
317+
313318

314319
if __name__ == '__main__':
315320
print ('NOTE: Please run these tests only with a test account. ' +

0 commit comments

Comments
 (0)