Skip to content

Commit

Permalink
Pass all args as kwargs instead of *glob + kwargs=
Browse files Browse the repository at this point in the history
  • Loading branch information
sshirokov committed Feb 20, 2013
1 parent 8bcfe31 commit b6ff1fc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion S3/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ def formatDateTime(s3timestamp):
try:
import pytz
timezone = pytz.timezone(os.environ.get('TZ', 'UTC'))
utc_dt = datetime.datetime(*dateS3toPython(s3timestamp)[0:6], tzinfo=pytz.timezone('UTC'))
tz = pytz.timezone('UTC')
## Can't unpack args and follow that with kwargs in python 2.5
## So we pass them all as kwargs
params = zip(('year', 'month', 'day', 'hour', 'minute', 'second', 'tzinfo'),
dateS3toPython(s3timestamp)[0:6] + (tz))
params = dict(params)
utc_dt = datetime.datetime(**params)
dt_object = utc_dt.astimezone(timezone)
except ImportError:
dt_object = datetime.datetime(*dateS3toPython(s3timestamp)[0:6])
Expand Down

0 comments on commit b6ff1fc

Please sign in to comment.