X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=parserrules.py;h=f1c55c11492019f4c8ba301296a56d17d13bee4e;hb=257bf962578c430062608cb1e10248ec854423db;hp=cf60f984f6695d3ef398b7b4154bd37306c786e0;hpb=5dc6aee6a1edf911312f0d7fea022dd44410bd42;p=frenchie%2Ficalparse.git diff --git a/parserrules.py b/parserrules.py index cf60f98..f1c55c1 100644 --- a/parserrules.py +++ b/parserrules.py @@ -28,6 +28,9 @@ import vobject +ruleConfig = {} +ruleConfig["defaultTZ"] = "UTC" + def facebookOrganiser(cal): '''Adds organiser details to the body of facebook calendars.''' @@ -104,8 +107,7 @@ def exDate(cal): from datetime import datetime from pytz import timezone - default = timezone('Australia/Perth') - + default = timezone(ruleConfig["defaultTZ"]) for event in cal.vevent_list: if not event.contents.has_key(u'exdate'): continue @@ -123,12 +125,13 @@ def exDate(cal): return cal def utcise(cal): - '''Removing local timezones in favour of UTC''' + '''Removing local timezones in favour of UTC. If the remote calendar specifies a timezone + then use it, otherwise assume it's in the user-specified or default values''' from datetime import datetime from pytz import timezone - default = timezone('Australia/Perth') + default = timezone(ruleConfig["defaultTZ"]) for event in cal.vevent_list: dtstart = getattr(event, 'dtstart', None) @@ -163,7 +166,8 @@ def unwantedParams(cal): return cal def exDate(cal): - '''Changes multi-EXDATE into singles (apple can't obey even simple specs)''' + '''Changes multi-EXDATE into singles (apple can't obey even simple specs). + If the remote calendar specifies a timezone then use it, otherwise use the user specified value''' for event in cal.vevent_list: if not event.contents.has_key(u'exdate'): continue