replace django.utils.timezone.UTC by utc (#25313)
This commit is contained in:
parent
2f0ae6bacf
commit
835e0cf940
|
@ -5,7 +5,7 @@ import json
|
|||
|
||||
import requests
|
||||
|
||||
from django.utils.timezone import UTC
|
||||
from django.utils.timezone import utc
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
|
@ -111,7 +111,7 @@ KEY_TYPES = {
|
|||
def parse_timestamp(tstamp):
|
||||
if not isinstance(tstamp, int):
|
||||
raise ValueError('%s' % tstamp)
|
||||
return datetime.datetime.fromtimestamp(tstamp, UTC())
|
||||
return datetime.datetime.fromtimestamp(tstamp, utc)
|
||||
|
||||
|
||||
class IDToken(str):
|
||||
|
|
|
@ -5,7 +5,7 @@ import base64
|
|||
import time
|
||||
|
||||
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotAllowed
|
||||
from django.utils.timezone import now, UTC
|
||||
from django.utils.timezone import now, utc
|
||||
from django.utils.http import urlencode
|
||||
from django.shortcuts import render
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
@ -254,7 +254,7 @@ def authorize(request, *args, **kwargs):
|
|||
client=client, user=request.user, scopes=u' '.join(scopes),
|
||||
state=state, nonce=nonce, redirect_uri=redirect_uri,
|
||||
expired=start + datetime.timedelta(seconds=30),
|
||||
auth_time=datetime.datetime.fromtimestamp(last_auth['when'], UTC()),
|
||||
auth_time=datetime.datetime.fromtimestamp(last_auth['when'], utc),
|
||||
session_key=request.session.session_key)
|
||||
logger.info(u'sending code %s for scopes %s for service %s',
|
||||
code.uuid, ' '.join(scopes),
|
||||
|
|
|
@ -10,7 +10,7 @@ from jwcrypto.jwt import JWT
|
|||
|
||||
from httmock import urlmatch, HTTMock
|
||||
|
||||
from django.utils.timezone import UTC
|
||||
from django.utils.timezone import utc
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.utils.timezone import now
|
||||
|
@ -77,8 +77,8 @@ def test_idtoken():
|
|||
assert token.iss == payload_decoded['iss']
|
||||
assert token.aud == payload_decoded['aud']
|
||||
assert token.nonce == payload_decoded['nonce']
|
||||
assert token.iat == datetime.datetime(2011, 7, 21, 20, 42, 50, tzinfo=UTC())
|
||||
assert token.exp == datetime.datetime(2011, 7, 21, 20, 59, 30, tzinfo=UTC())
|
||||
assert token.iat == datetime.datetime(2011, 7, 21, 20, 42, 50, tzinfo=utc)
|
||||
assert token.exp == datetime.datetime(2011, 7, 21, 20, 59, 30, tzinfo=utc)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
Loading…
Reference in New Issue