Add strptime()
hack for older systems (?)
not actually sure what the issue is there, but this works..
This commit is contained in:
parent
8d858d74bd
commit
a997ffc7bb
|
@ -59,8 +59,16 @@ class FromMailChimp(importing.Importer):
|
||||||
self.mailchimp = MailChimp(self.api_key)
|
self.mailchimp = MailChimp(self.api_key)
|
||||||
|
|
||||||
def mailchimp_datetime(self, value):
|
def mailchimp_datetime(self, value):
|
||||||
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S%z')
|
if value.endswith('+00:00'):
|
||||||
dt = localtime(self.config, dt)
|
# TODO: for some reason the '%z' format did not work on a
|
||||||
|
# python 3.5 system, so here we try to ignore the
|
||||||
|
# issue..since we clearly have a UTC value
|
||||||
|
value = value[:-6]
|
||||||
|
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S')
|
||||||
|
dt = localtime(self.config, dt, from_utc=True)
|
||||||
|
else:
|
||||||
|
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S%z')
|
||||||
|
dt = localtime(self.config, dt)
|
||||||
return dt
|
return dt
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue