diff options
author | Mike Linksvayer <ml@gondwanaland.com> | 2012-12-20 12:50:43 -0800 |
---|---|---|
committer | Mike Linksvayer <ml@gondwanaland.com> | 2012-12-20 12:50:43 -0800 |
commit | 1d0148aef1493467dacb6c39c4e080ee4a5246d2 (patch) | |
tree | 5213418660d4e079eb8dac6bc8ea2e4fdc140088 /mediagoblin/plugins/oauth/views.py | |
parent | 200433dc38a2139462e0331be36ee49a80a81a12 (diff) | |
parent | 5c99cd01a70f2d597ac7669e8d944ddf79b05281 (diff) | |
download | mediagoblin-1d0148aef1493467dacb6c39c4e080ee4a5246d2.tar.lz mediagoblin-1d0148aef1493467dacb6c39c4e080ee4a5246d2.tar.xz mediagoblin-1d0148aef1493467dacb6c39c4e080ee4a5246d2.zip |
Merge branch 'master' of git://gitorious.org/mediagoblin/mediagoblin
Conflicts:
docs/source/siteadmin/media-types.rst
Diffstat (limited to 'mediagoblin/plugins/oauth/views.py')
-rw-r--r-- | mediagoblin/plugins/oauth/views.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mediagoblin/plugins/oauth/views.py b/mediagoblin/plugins/oauth/views.py index cf605fd2..643c2783 100644 --- a/mediagoblin/plugins/oauth/views.py +++ b/mediagoblin/plugins/oauth/views.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # GNU MediaGoblin -- federated, autonomous media hosting # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. # @@ -216,12 +217,15 @@ def access_token(request): token.client = code.client token.save() + # expire time of token in full seconds + # timedelta.total_seconds is python >= 2.7 or we would use that + td = token.expires - datetime.now() + exp_in = 86400*td.days + td.seconds # just ignore µsec + access_token_data = { 'access_token': token.token, 'token_type': 'bearer', - 'expires_in': int( - round( - (token.expires - datetime.now()).total_seconds()))} + 'expires_in': exp_in} return json_response(access_token_data, _disable_cors=True) else: return json_response({ |