Merge lp:~roadmr/canonical-identity-provider/fix-deprecation-warnings-3 into lp:canonical-identity-provider/release

Proposed by Daniel Manrique
Status: Merged
Approved by: Daniel Manrique
Approved revision: no longer in the source branch.
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: lp:~roadmr/canonical-identity-provider/fix-deprecation-warnings-3
Merge into: lp:canonical-identity-provider/release
Diff against target: 808 lines (+68/-62)
50 files modified
src/api/v10/tests/test_handlers.py (+1/-1)
src/api/v20/tests/test_auth.py (+1/-1)
src/api/v20/tests/test_decorators.py (+1/-1)
src/api/v20/tests/test_handlers.py (+2/-1)
src/api/v20/tests/test_login.py (+1/-1)
src/api/v20/tests/test_urls.py (+2/-1)
src/api/v20/tests/test_utils.py (+1/-1)
src/api/v20/utils.py (+1/-1)
src/identityprovider/admin.py (+1/-1)
src/identityprovider/emailutils.py (+1/-1)
src/identityprovider/forms.py (+1/-1)
src/identityprovider/middleware/useraccount.py (+1/-1)
src/identityprovider/middleware/xrds.py (+2/-1)
src/identityprovider/models/authtoken.py (+1/-1)
src/identityprovider/tests/helpers.py (+1/-1)
src/identityprovider/tests/openid_server/per_version/test_logout_during_login.py (+1/-1)
src/identityprovider/tests/openid_server/per_version/test_sso_workflow_authorize.py (+1/-1)
src/identityprovider/tests/sso_server/test_standalone_login.py (+1/-1)
src/identityprovider/tests/test_admin.py (+1/-1)
src/identityprovider/tests/test_emailutils.py (+1/-1)
src/identityprovider/tests/test_models_authtoken.py (+1/-1)
src/identityprovider/tests/test_readonly.py (+1/-1)
src/identityprovider/tests/test_signals.py (+1/-1)
src/identityprovider/tests/test_views_server.py (+1/-1)
src/identityprovider/tests/test_views_testing.py (+1/-1)
src/identityprovider/tests/test_xrds.py (+1/-1)
src/identityprovider/utils.py (+1/-1)
src/identityprovider/views/server.py (+1/-1)
src/identityprovider/widgets.py (+12/-10)
src/ubuntu_sso_saml/tests/test_processors.py (+1/-1)
src/ubuntu_sso_saml/tests/test_views.py (+1/-1)
src/ubuntu_sso_saml/views.py (+1/-1)
src/webui/decorators.py (+1/-1)
src/webui/tests/test_decorators.py (+2/-2)
src/webui/tests/test_templates.py (+1/-1)
src/webui/tests/test_views_account.py (+2/-1)
src/webui/tests/test_views_account_ssh.py (+1/-1)
src/webui/tests/test_views_auth_log.py (+1/-1)
src/webui/tests/test_views_consumer.py (+1/-1)
src/webui/tests/test_views_devices.py (+1/-1)
src/webui/tests/test_views_i18n.py (+1/-1)
src/webui/tests/test_views_registration.py (+1/-1)
src/webui/tests/test_views_ui.py (+3/-3)
src/webui/views/account.py (+1/-1)
src/webui/views/consumer.py (+1/-1)
src/webui/views/devices.py (+1/-1)
src/webui/views/errors.py (+1/-1)
src/webui/views/i18n.py (+1/-1)
src/webui/views/registration.py (+1/-1)
src/webui/views/ui.py (+1/-1)
To merge this branch: bzr merge lp:~roadmr/canonical-identity-provider/fix-deprecation-warnings-3
Reviewer Review Type Date Requested Status
Maximiliano Bertacchini Approve
Review via email: mp+347154@code.launchpad.net

Commit message

Fix most remaining Django and Python deprecation warnings in the sso codebase itself.

Some of the remaining ones probably need fixing in dependencies:
- django-statsd
- django-openid-auth
- django-piston
- django-honeypot
- raven
- preflight
- oauthlib

Other than the ones from dependencies, the remaining deprecation warnings are:

- most of the middlewares. RemovedInDjango20Warning: Old-style middleware using settings.MIDDLEWARE_CLASSES is deprecated. Update your middleware and use settings.MIDDLEWARE instead.
- identityprovider/models/twofactor.py:103: RemovedInDjango20Warning: Using user.is_authenticated() and user.is_anonymous() as a method is deprecated. Remove the parentheses to use it as an attribute. This needs updating django-openid-auth to make its is_authenticated method an attribute, to avoid ugly "is it callable?" logic in SSO itself.

Description of the change

Fix most remaining Django and Python deprecation warnings in the sso codebase itself.

Some of the remaining ones probably need fixing in dependencies:
- django-statsd
- django-openid-auth
- django-piston
- django-honeypot
- raven
- preflight
- oauthlib

Other than the ones from dependencies, the remaining deprecation warnings are:

- most of the middlewares. RemovedInDjango20Warning: Old-style middleware using settings.MIDDLEWARE_CLASSES is deprecated. Update your middleware and use settings.MIDDLEWARE instead.
- identityprovider/models/twofactor.py:103: RemovedInDjango20Warning: Using user.is_authenticated() and user.is_anonymous() as a method is deprecated. Remove the parentheses to use it as an attribute. This needs updating django-openid-auth to make its is_authenticated method an attribute, to avoid ugly "is it callable?" logic in SSO itself.

To post a comment you must log in.
Revision history for this message
Maximiliano Bertacchini (maxiberta) wrote :

+1, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/api/v10/tests/test_handlers.py'
2--- src/api/v10/tests/test_handlers.py 2018-02-09 20:56:16 +0000
3+++ src/api/v10/tests/test_handlers.py 2018-05-30 16:21:15 +0000
4@@ -9,8 +9,8 @@
5
6 from django.conf import settings
7 from django.core import mail
8-from django.core.urlresolvers import reverse
9 from django.test.utils import override_settings
10+from django.urls import reverse
11 from django.utils.http import urlencode
12 from django.utils.timezone import now
13 from gargoyle.testutils import switches
14
15=== modified file 'src/api/v20/tests/test_auth.py'
16--- src/api/v20/tests/test_auth.py 2018-02-09 20:56:16 +0000
17+++ src/api/v20/tests/test_auth.py 2018-05-30 16:21:15 +0000
18@@ -5,8 +5,8 @@
19 import json
20 from urllib import urlencode
21
22-from django.core.urlresolvers import reverse
23 from django.test.client import RequestFactory
24+from django.urls import reverse
25 from piston.handler import AnonymousBaseHandler
26 from piston.resource import Resource
27
28
29=== modified file 'src/api/v20/tests/test_decorators.py'
30--- src/api/v20/tests/test_decorators.py 2018-02-14 14:05:59 +0000
31+++ src/api/v20/tests/test_decorators.py 2018-05-30 16:21:15 +0000
32@@ -4,8 +4,8 @@
33
34 from django.conf.urls import url
35 from django.core.cache import cache
36-from django.core.urlresolvers import reverse
37 from django.test import override_settings
38+from django.urls import reverse
39 from memcache import Client
40 from piston.handler import BaseHandler
41 from piston.resource import Resource
42
43=== modified file 'src/api/v20/tests/test_handlers.py'
44--- src/api/v20/tests/test_handlers.py 2018-02-14 14:05:59 +0000
45+++ src/api/v20/tests/test_handlers.py 2018-05-30 16:21:15 +0000
46@@ -16,9 +16,10 @@
47 from django.contrib.auth.models import AnonymousUser
48 from django.core import mail
49 from django.core.serializers.json import DjangoJSONEncoder
50-from django.core.urlresolvers import NoReverseMatch, reverse
51 from django.test.client import RequestFactory
52 from django.test.utils import override_settings
53+from django.urls import reverse
54+from django.urls.exceptions import NoReverseMatch
55 from django.utils.timezone import now
56 from gargoyle.testutils import switches
57 from mock import Mock, patch
58
59=== modified file 'src/api/v20/tests/test_login.py'
60--- src/api/v20/tests/test_login.py 2018-02-21 11:59:00 +0000
61+++ src/api/v20/tests/test_login.py 2018-05-30 16:21:15 +0000
62@@ -2,7 +2,7 @@
63
64 from django.contrib.auth.hashers import make_password
65 from django.core.serializers.json import DjangoJSONEncoder
66-from django.core.urlresolvers import reverse
67+from django.urls import reverse
68 from django.utils.timezone import now
69 from timeline import Timeline
70
71
72=== modified file 'src/api/v20/tests/test_urls.py'
73--- src/api/v20/tests/test_urls.py 2016-06-08 05:03:11 +0000
74+++ src/api/v20/tests/test_urls.py 2018-05-30 16:21:15 +0000
75@@ -1,4 +1,5 @@
76-from django.core.urlresolvers import resolve, reverse
77+from django.urls import reverse
78+from django.urls.base import resolve
79 from piston.authentication import NoAuthentication
80
81 from api.v20 import auth, handlers
82
83=== modified file 'src/api/v20/tests/test_utils.py'
84--- src/api/v20/tests/test_utils.py 2018-01-27 13:11:38 +0000
85+++ src/api/v20/tests/test_utils.py 2018-05-30 16:21:15 +0000
86@@ -3,7 +3,7 @@
87 from functools import partial
88 from operator import attrgetter
89
90-from django.core.urlresolvers import reverse
91+from django.urls import reverse
92
93 from api.v20.utils import (
94 EnsureJSONResponseOnAPIErrorMiddleware,
95
96=== modified file 'src/api/v20/utils.py'
97--- src/api/v20/utils.py 2018-02-09 14:17:25 +0000
98+++ src/api/v20/utils.py 2018-05-30 16:21:15 +0000
99@@ -4,8 +4,8 @@
100 import json
101 from operator import attrgetter
102
103-from django.core.urlresolvers import reverse
104 from django.http import HttpResponse
105+from django.urls import reverse
106 from django.utils.translation import ugettext_lazy as _
107
108 from identityprovider.models.account import Account
109
110=== modified file 'src/identityprovider/admin.py'
111--- src/identityprovider/admin.py 2018-05-29 17:14:24 +0000
112+++ src/identityprovider/admin.py 2018-05-30 16:21:15 +0000
113@@ -14,10 +14,10 @@
114 from django.contrib.auth.hashers import make_password
115 from django.contrib.auth.models import User
116 from django.core import validators
117-from django.core.urlresolvers import reverse
118 from django.db import connections
119 from django.db.models.query import QuerySet
120 from django.template.defaultfilters import force_escape
121+from django.urls import reverse
122 from django.utils.html import format_html
123 from oauth_backend.models import Consumer as V1Consumer, Token as V1Token
124
125
126=== modified file 'src/identityprovider/emailutils.py'
127--- src/identityprovider/emailutils.py 2018-04-04 15:35:18 +0000
128+++ src/identityprovider/emailutils.py 2018-05-30 16:21:15 +0000
129@@ -6,8 +6,8 @@
130
131 from django.conf import settings
132 from django.core.mail import send_mail
133-from django.core.urlresolvers import reverse
134 from django.template.loader import render_to_string
135+from django.urls import reverse
136 from django.utils.timezone import now
137 from django.utils.translation import ugettext_lazy as _
138
139
140=== modified file 'src/identityprovider/forms.py'
141--- src/identityprovider/forms.py 2018-05-25 21:47:30 +0000
142+++ src/identityprovider/forms.py 2018-05-30 16:21:15 +0000
143@@ -6,8 +6,8 @@
144
145 from django import forms
146 from django.conf import settings
147-from django.core.urlresolvers import reverse
148 from django.forms import Form, fields, widgets
149+from django.urls import reverse
150 from django.utils import translation
151 from django.utils.translation import ugettext_lazy as _
152 from gargoyle import gargoyle
153
154=== modified file 'src/identityprovider/middleware/useraccount.py'
155--- src/identityprovider/middleware/useraccount.py 2016-06-08 17:05:05 +0000
156+++ src/identityprovider/middleware/useraccount.py 2018-05-30 16:21:15 +0000
157@@ -41,7 +41,7 @@
158 logout(request)
159
160 def process_request(self, request):
161- if request.user.is_authenticated():
162+ if request.user.is_authenticated:
163 is_admin_url = self.is_admin_area(request.get_full_path())
164 if isinstance(request.user, User) and not is_admin_url:
165 try:
166
167=== modified file 'src/identityprovider/middleware/xrds.py'
168--- src/identityprovider/middleware/xrds.py 2018-02-09 20:56:16 +0000
169+++ src/identityprovider/middleware/xrds.py 2018-05-30 16:21:15 +0000
170@@ -3,10 +3,11 @@
171
172 from urlparse import urlparse
173
174-from django.core.urlresolvers import resolve, reverse
175 from django.http import Http404, HttpResponse
176 from django.shortcuts import get_object_or_404
177 from django.template.loader import render_to_string
178+from django.urls import reverse
179+from django.urls.base import resolve
180
181 from openid.yadis.accept import getAcceptable
182 from openid.yadis.constants import YADIS_CONTENT_TYPE, YADIS_HEADER_NAME
183
184=== modified file 'src/identityprovider/models/authtoken.py'
185--- src/identityprovider/models/authtoken.py 2018-05-25 16:27:25 +0000
186+++ src/identityprovider/models/authtoken.py 2018-05-30 16:21:15 +0000
187@@ -8,10 +8,10 @@
188
189 from hashlib import sha256
190
191-from django.core.urlresolvers import reverse
192 from django.core.validators import validate_email
193 from django.db import models
194 from django.http import Http404
195+from django.urls import reverse
196 from django.utils.timezone import now
197
198 from identityprovider.models.account import (
199
200=== modified file 'src/identityprovider/tests/helpers.py'
201--- src/identityprovider/tests/helpers.py 2018-02-20 17:13:36 +0000
202+++ src/identityprovider/tests/helpers.py 2018-05-30 16:21:15 +0000
203@@ -7,7 +7,7 @@
204
205 from django.contrib.auth.models import User
206 from django.core import mail
207-from django.core.urlresolvers import reverse
208+from django.urls import reverse
209 from openid import fetchers
210 from openid.consumer.consumer import Consumer
211 from openid.consumer.discover import (
212
213=== modified file 'src/identityprovider/tests/openid_server/per_version/test_logout_during_login.py'
214--- src/identityprovider/tests/openid_server/per_version/test_logout_during_login.py 2013-11-12 15:30:36 +0000
215+++ src/identityprovider/tests/openid_server/per_version/test_logout_during_login.py 2018-05-30 16:21:15 +0000
216@@ -1,4 +1,4 @@
217-from django.core.urlresolvers import reverse
218+from django.urls import reverse
219
220 from identityprovider.tests.helpers import OpenIDTestCase
221
222
223=== modified file 'src/identityprovider/tests/openid_server/per_version/test_sso_workflow_authorize.py'
224--- src/identityprovider/tests/openid_server/per_version/test_sso_workflow_authorize.py 2013-04-01 15:24:48 +0000
225+++ src/identityprovider/tests/openid_server/per_version/test_sso_workflow_authorize.py 2018-05-30 16:21:15 +0000
226@@ -1,4 +1,4 @@
227-from django.core.urlresolvers import reverse
228+from django.urls import reverse
229
230 from identityprovider.models import OpenIDRPSummary
231 from identityprovider.tests.helpers import OpenIDTestCase
232
233=== modified file 'src/identityprovider/tests/sso_server/test_standalone_login.py'
234--- src/identityprovider/tests/sso_server/test_standalone_login.py 2018-02-09 20:56:16 +0000
235+++ src/identityprovider/tests/sso_server/test_standalone_login.py 2018-05-30 16:21:15 +0000
236@@ -1,4 +1,4 @@
237-from django.core.urlresolvers import reverse
238+from django.urls import reverse
239
240 from identityprovider.models.account import Account
241 from identityprovider.tests import DEFAULT_USER_PASSWORD
242
243=== modified file 'src/identityprovider/tests/test_admin.py'
244--- src/identityprovider/tests/test_admin.py 2018-05-29 17:14:24 +0000
245+++ src/identityprovider/tests/test_admin.py 2018-05-30 16:21:15 +0000
246@@ -14,8 +14,8 @@
247 )
248 from django.contrib.auth.hashers import check_password
249 from django.contrib.auth.models import User
250-from django.core.urlresolvers import reverse
251 from django.db import connections
252+from django.urls import reverse
253 from django.utils.dateformat import format
254 from django.utils.timezone import now
255 from mock import MagicMock, Mock, patch
256
257=== modified file 'src/identityprovider/tests/test_emailutils.py'
258--- src/identityprovider/tests/test_emailutils.py 2017-05-09 18:02:49 +0000
259+++ src/identityprovider/tests/test_emailutils.py 2018-05-30 16:21:15 +0000
260@@ -8,9 +8,9 @@
261
262 from django.conf import settings
263 from django.core import mail
264-from django.core.urlresolvers import reverse
265 from django.template.loader import render_to_string
266 from django.test.utils import override_settings
267+from django.urls import reverse
268 from django.utils.timezone import now
269 from mock import patch
270
271
272=== modified file 'src/identityprovider/tests/test_models_authtoken.py'
273--- src/identityprovider/tests/test_models_authtoken.py 2018-02-09 20:56:16 +0000
274+++ src/identityprovider/tests/test_models_authtoken.py 2018-05-30 16:21:15 +0000
275@@ -6,9 +6,9 @@
276
277 from django.conf import settings
278 from django.core.exceptions import MultipleObjectsReturned, ValidationError
279-from django.core.urlresolvers import reverse
280 from django.http import Http404
281 from django.test.utils import override_settings
282+from django.urls import reverse
283 from django.utils.timezone import now
284 from mock import patch
285
286
287=== modified file 'src/identityprovider/tests/test_readonly.py'
288--- src/identityprovider/tests/test_readonly.py 2018-02-09 20:56:16 +0000
289+++ src/identityprovider/tests/test_readonly.py 2018-05-30 16:21:15 +0000
290@@ -10,7 +10,7 @@
291 import requests
292 import responses
293 from django.conf import settings
294-from django.core.urlresolvers import reverse
295+from django.urls import reverse
296
297 from identityprovider.readonly import (
298 ReadOnlyManager,
299
300=== modified file 'src/identityprovider/tests/test_signals.py'
301--- src/identityprovider/tests/test_signals.py 2018-01-23 17:51:11 +0000
302+++ src/identityprovider/tests/test_signals.py 2018-05-30 16:21:15 +0000
303@@ -5,11 +5,11 @@
304
305 from django.conf import settings
306 from django.contrib.auth.signals import user_logged_in
307-from django.core.urlresolvers import reverse
308 from django.db.models.signals import (
309 post_save,
310 pre_delete,
311 )
312+from django.urls import reverse
313 from django.utils.timezone import now
314
315 from mock import Mock, patch
316
317=== modified file 'src/identityprovider/tests/test_views_server.py'
318--- src/identityprovider/tests/test_views_server.py 2018-02-20 17:12:17 +0000
319+++ src/identityprovider/tests/test_views_server.py 2018-05-30 16:21:15 +0000
320@@ -12,9 +12,9 @@
321 from django.contrib import messages
322 from django.contrib.auth.models import AnonymousUser
323 from django.core.cache import cache
324-from django.core.urlresolvers import reverse
325 from django.http import HttpRequest
326 from django.test.utils import override_settings, patch_logger
327+from django.urls import reverse
328 from django.utils.timezone import now
329 from gargoyle.testutils import switches
330 from mock import Mock
331
332=== modified file 'src/identityprovider/tests/test_views_testing.py'
333--- src/identityprovider/tests/test_views_testing.py 2018-02-09 20:56:16 +0000
334+++ src/identityprovider/tests/test_views_testing.py 2018-05-30 16:21:15 +0000
335@@ -2,8 +2,8 @@
336 # GNU Affero General Public License version 3 (see the file LICENSE).
337
338 from django.conf import settings
339-from django.core.urlresolvers import reverse
340 from django.test.utils import patch_logger
341+from django.urls import reverse
342
343 from identityprovider.tests.utils import SSOBaseTestCase
344 from identityprovider.views.testing import (
345
346=== modified file 'src/identityprovider/tests/test_xrds.py'
347--- src/identityprovider/tests/test_xrds.py 2018-02-09 20:56:16 +0000
348+++ src/identityprovider/tests/test_xrds.py 2018-05-30 16:21:15 +0000
349@@ -1,8 +1,8 @@
350 # Copyright 2010 Canonical Ltd. This software is licensed under the
351 # GNU Affero General Public License version 3 (see the file LICENSE).
352
353-from django.core.urlresolvers import reverse
354 from django.test.utils import override_settings, patch_logger
355+from django.urls import reverse
356
357 from identityprovider.tests.utils import SSOBaseTestCase
358
359
360=== modified file 'src/identityprovider/utils.py'
361--- src/identityprovider/utils.py 2018-01-27 13:11:38 +0000
362+++ src/identityprovider/utils.py 2018-05-30 16:21:15 +0000
363@@ -15,9 +15,9 @@
364 from django.conf import settings
365 from django.contrib.sessions.models import Session
366 from django.core.exceptions import ObjectDoesNotExist
367-from django.core.urlresolvers import reverse
368 from django.db import connection, transaction
369 from django.db.utils import ProgrammingError
370+from django.urls import reverse
371 from django.utils.translation import ugettext_lazy as _
372
373 SALT_LENGTH = 20
374
375=== modified file 'src/identityprovider/views/server.py'
376--- src/identityprovider/views/server.py 2018-05-25 20:41:26 +0000
377+++ src/identityprovider/views/server.py 2018-05-30 16:21:15 +0000
378@@ -10,7 +10,6 @@
379
380 from django.conf import settings
381 from django.contrib import auth, messages
382-from django.core.urlresolvers import reverse
383 from django.http import (
384 Http404,
385 HttpResponse,
386@@ -20,6 +19,7 @@
387 )
388 from django.shortcuts import get_object_or_404, render
389 from django.template import loader
390+from django.urls import reverse
391 from django.utils import translation
392 from django.utils.decorators import decorator_from_middleware
393 from django.utils.timezone import now
394
395=== modified file 'src/identityprovider/widgets.py'
396--- src/identityprovider/widgets.py 2018-05-28 17:05:47 +0000
397+++ src/identityprovider/widgets.py 2018-05-30 16:21:15 +0000
398@@ -30,15 +30,16 @@
399
400
401 class ROAwareTextInput(TextInput):
402- def render(self, name, value, attrs=None):
403+ def render(self, name, value, attrs=None, renderer=None):
404 if settings.READ_ONLY_MODE:
405 return read_only_markup(value)
406 else:
407- return super(ROAwareTextInput, self).render(name, value, attrs)
408+ return super(ROAwareTextInput, self).render(
409+ name, value, attrs, renderer)
410
411
412 class ROAwareSelect(Select):
413- def render(self, name, value, attrs=None):
414+ def render(self, name, value, attrs=None, renderer=None):
415 if settings.READ_ONLY_MODE:
416 label = ''
417 for option_value, option_label in self.choices:
418@@ -47,11 +48,12 @@
419 break
420 return read_only_markup(label)
421 else:
422- return super(ROAwareSelect, self).render(name, value, attrs)
423+ return super(ROAwareSelect, self).render(
424+ name, value, attrs, renderer)
425
426
427 class CommaSeparatedWidget(CheckboxSelectMultiple):
428- def render(self, name, value, attrs=None):
429+ def render(self, name, value, attrs=None, renderer=None):
430 if value is None:
431 value = ''
432 if isinstance(value, list):
433@@ -59,14 +61,14 @@
434 else:
435 vals = value.split(',')
436 return super(CommaSeparatedWidget, self).render(
437- name, vals, attrs)
438+ name, vals, attrs, renderer)
439
440
441 class StatusWidget(Select):
442 date_status_set = None
443
444- def render(self, name, value, attrs=None):
445- select = super(StatusWidget, self).render(name, value, attrs)
446+ def render(self, name, value, attrs=None, renderer=None):
447+ select = super(StatusWidget, self).render(name, value, attrs, renderer)
448 if self.date_status_set:
449 status_date = _("Set on %s") % self.date_status_set
450 else:
451@@ -77,12 +79,12 @@
452 class ReadOnlyDateTimeWidget(Widget):
453 value = None
454
455- def render(self, name, value, attrs=None):
456+ def render(self, name, value, attrs=None, renderer=None):
457 return str(self.value)
458
459
460 class LPUsernameWidget(Widget):
461 account = None
462
463- def render(self, name, value, attrs=None):
464+ def render(self, name, value, attrs=None, renderer=None):
465 return mark_safe_lazy(account_to_lp_link(self.account))
466
467=== modified file 'src/ubuntu_sso_saml/tests/test_processors.py'
468--- src/ubuntu_sso_saml/tests/test_processors.py 2018-04-16 16:32:22 +0000
469+++ src/ubuntu_sso_saml/tests/test_processors.py 2018-05-30 16:21:15 +0000
470@@ -10,9 +10,9 @@
471 from StringIO import StringIO
472 from xml.dom import minidom
473
474-from django.core.urlresolvers import reverse
475 from django.test.client import Client
476 from django.test.utils import override_settings
477+from django.urls import reverse
478 from gargoyle.models import GLOBAL, Switch
479 from gargoyle.testutils import switches
480 from lxml import etree
481
482=== modified file 'src/ubuntu_sso_saml/tests/test_views.py'
483--- src/ubuntu_sso_saml/tests/test_views.py 2018-04-04 14:49:47 +0000
484+++ src/ubuntu_sso_saml/tests/test_views.py 2018-05-30 16:21:15 +0000
485@@ -1,6 +1,6 @@
486 import copy
487
488-from django.core.urlresolvers import reverse
489+from django.urls import reverse
490 from saml2idp import saml2idp_metadata
491
492 from identityprovider.tests.utils import SSOBaseTestCase
493
494=== modified file 'src/ubuntu_sso_saml/views.py'
495--- src/ubuntu_sso_saml/views.py 2018-04-04 14:49:47 +0000
496+++ src/ubuntu_sso_saml/views.py 2018-05-30 16:21:15 +0000
497@@ -3,8 +3,8 @@
498 import logging
499 from urlparse import urlparse, urlunparse
500
501-from django.core.urlresolvers import reverse
502 from django.shortcuts import get_object_or_404, redirect, render
503+from django.urls import reverse
504 from django.utils.datastructures import MultiValueDictKeyError
505 from django.views.decorators.csrf import csrf_exempt
506 from saml2idp import registry, saml2idp_metadata, xml_signing
507
508=== modified file 'src/webui/decorators.py'
509--- src/webui/decorators.py 2018-05-25 20:41:26 +0000
510+++ src/webui/decorators.py 2018-05-30 16:21:15 +0000
511@@ -16,7 +16,6 @@
512 )
513 from django.contrib.auth.views import redirect_to_login
514 from django.core.cache import cache
515-from django.core.urlresolvers import reverse
516 from django.http import (
517 Http404,
518 HttpResponseForbidden,
519@@ -24,6 +23,7 @@
520 )
521 from django.template.loader import render_to_string
522 from django.template.response import TemplateResponse
523+from django.urls import reverse
524 from django.utils.decorators import available_attrs
525 from django.utils.http import (
526 urlencode,
527
528=== modified file 'src/webui/tests/test_decorators.py'
529--- src/webui/tests/test_decorators.py 2017-10-04 19:52:55 +0000
530+++ src/webui/tests/test_decorators.py 2018-05-30 16:21:15 +0000
531@@ -4,11 +4,11 @@
532
533 from django.conf import settings
534 from django.contrib.auth.models import AnonymousUser
535-from django.core.urlresolvers import reverse
536 from django.http import (
537 Http404,
538 HttpResponseRedirect,
539 )
540+from django.urls import reverse
541 from django.utils.timezone import now
542 from gargoyle.testutils import switches
543
544@@ -354,7 +354,7 @@
545 self.assertEqual(self.calls, [])
546 # user was logged out
547 self.assertIsInstance(self.request.user, AnonymousUser)
548- self.assertFalse(self.request.user.is_authenticated())
549+ self.assertFalse(self.request.user.is_authenticated)
550
551
552 class SSOLoginRequiredNoEmailsTestCase(
553
554=== modified file 'src/webui/tests/test_templates.py'
555--- src/webui/tests/test_templates.py 2017-05-22 21:18:47 +0000
556+++ src/webui/tests/test_templates.py 2018-05-30 16:21:15 +0000
557@@ -1,7 +1,7 @@
558 from __future__ import unicode_literals
559
560-from django.core.urlresolvers import reverse
561 from django.template.loader import render_to_string
562+from django.urls import reverse
563 from mock import patch
564 from pyquery import PyQuery
565
566
567=== modified file 'src/webui/tests/test_views_account.py'
568--- src/webui/tests/test_views_account.py 2018-05-09 20:50:02 +0000
569+++ src/webui/tests/test_views_account.py 2018-05-30 16:21:15 +0000
570@@ -13,8 +13,9 @@
571 from django.conf import settings
572 from django.contrib.auth.hashers import check_password
573 from django.core import mail
574-from django.core.urlresolvers import NoReverseMatch, reverse
575 from django.test.utils import override_settings
576+from django.urls import reverse
577+from django.urls.exceptions import NoReverseMatch
578 from gargoyle.testutils import switches
579 from pyquery import PyQuery
580
581
582=== modified file 'src/webui/tests/test_views_account_ssh.py'
583--- src/webui/tests/test_views_account_ssh.py 2018-02-08 15:12:52 +0000
584+++ src/webui/tests/test_views_account_ssh.py 2018-05-30 16:21:15 +0000
585@@ -3,7 +3,7 @@
586
587 from __future__ import unicode_literals
588
589-from django.core.urlresolvers import reverse
590+from django.urls import reverse
591 from gargoyle.testutils import switches
592 from mock import call
593
594
595=== modified file 'src/webui/tests/test_views_auth_log.py'
596--- src/webui/tests/test_views_auth_log.py 2018-02-09 20:56:16 +0000
597+++ src/webui/tests/test_views_auth_log.py 2018-05-30 16:21:15 +0000
598@@ -5,7 +5,7 @@
599 from __future__ import unicode_literals
600
601 from django.conf import settings
602-from django.core.urlresolvers import reverse
603+from django.urls import reverse
604 from django.utils.timezone import now, timedelta
605
606 from identityprovider.models.const import AuthLogType
607
608=== modified file 'src/webui/tests/test_views_consumer.py'
609--- src/webui/tests/test_views_consumer.py 2018-02-09 20:56:16 +0000
610+++ src/webui/tests/test_views_consumer.py 2018-05-30 16:21:15 +0000
611@@ -6,8 +6,8 @@
612
613 from urllib import quote_plus
614
615-from django.core.urlresolvers import reverse
616 from django.test.utils import override_settings
617+from django.urls import reverse
618 from openid import fetchers
619 from openid.consumer import consumer
620 from openid.consumer.discover import OPENID_2_0_TYPE, OpenIDServiceEndpoint
621
622=== modified file 'src/webui/tests/test_views_devices.py'
623--- src/webui/tests/test_views_devices.py 2018-03-16 13:30:26 +0000
624+++ src/webui/tests/test_views_devices.py 2018-05-30 16:21:15 +0000
625@@ -9,9 +9,9 @@
626
627 import mock
628 from django.conf import settings
629-from django.core.urlresolvers import reverse
630 from django.db import transaction
631 from django.test.utils import override_settings
632+from django.urls import reverse
633 from django.utils.timezone import now
634 from gargoyle.testutils import switches
635 from oath import hotp, totp
636
637=== modified file 'src/webui/tests/test_views_i18n.py'
638--- src/webui/tests/test_views_i18n.py 2018-02-09 20:56:16 +0000
639+++ src/webui/tests/test_views_i18n.py 2018-05-30 16:21:15 +0000
640@@ -1,6 +1,6 @@
641 from __future__ import unicode_literals
642
643-from django.core.urlresolvers import reverse
644+from django.urls import reverse
645
646 from identityprovider.models.account import Account
647 from identityprovider.tests import DEFAULT_USER_PASSWORD
648
649=== modified file 'src/webui/tests/test_views_registration.py'
650--- src/webui/tests/test_views_registration.py 2018-05-25 22:00:09 +0000
651+++ src/webui/tests/test_views_registration.py 2018-05-30 16:21:15 +0000
652@@ -9,8 +9,8 @@
653
654 from django.conf import settings
655 from django.contrib.auth.models import AnonymousUser
656-from django.core.urlresolvers import reverse
657 from django.test.utils import override_settings
658+from django.urls import reverse
659
660 from gargoyle.testutils import switches
661 from mock import Mock, call
662
663=== modified file 'src/webui/tests/test_views_ui.py'
664--- src/webui/tests/test_views_ui.py 2018-02-20 17:14:51 +0000
665+++ src/webui/tests/test_views_ui.py 2018-05-30 16:21:15 +0000
666@@ -25,9 +25,9 @@
667 from django.core import mail
668 from django.core.cache import cache
669 from django.core.exceptions import ValidationError
670-from django.core.urlresolvers import reverse
671 from django.http import QueryDict
672 from django.test.utils import override_settings
673+from django.urls import reverse
674 from django.utils.html import escape
675 from gargoyle import gargoyle
676 from gargoyle.testutils import switches
677@@ -1964,7 +1964,7 @@
678 account = Account.objects.get(id=self.account.id)
679
680 self.assertTemplateUsed(response, 'account/suspended.html')
681- self.assertFalse(response.context['user'].is_authenticated())
682+ self.assertFalse(response.context['user'].is_authenticated)
683 self.assertEqual(account.status, AccountStatus.SUSPENDED)
684 # since the account is NOT on the expected team, no email is sent
685 self.assert_no_emails_sent()
686@@ -1979,7 +1979,7 @@
687 account = Account.objects.get(id=self.account.id)
688
689 self.assertTemplateUsed(response, 'account/suspended.html')
690- self.assertFalse(response.context['user'].is_authenticated())
691+ self.assertFalse(response.context['user'].is_authenticated)
692 self.assertEqual(account.status, AccountStatus.SUSPENDED)
693 # since the account is on the expected team, a notification is sent
694 self.assert_account_suspended_warning_sent(account)
695
696=== modified file 'src/webui/views/account.py'
697--- src/webui/views/account.py 2018-05-25 20:41:26 +0000
698+++ src/webui/views/account.py 2018-05-30 16:21:15 +0000
699@@ -10,11 +10,11 @@
700
701 from django.conf import settings
702 from django.contrib import auth, messages
703-from django.core.urlresolvers import reverse
704 from django.http import HttpResponseRedirect
705 from django.shortcuts import get_object_or_404, render
706 from django.template.loader import render_to_string
707 from django.template.response import TemplateResponse
708+from django.urls import reverse
709 from django.views.decorators.vary import vary_on_headers
710 from gargoyle import gargoyle
711 from gargoyle.decorators import switch_is_active
712
713=== modified file 'src/webui/views/consumer.py'
714--- src/webui/views/consumer.py 2018-02-09 20:56:16 +0000
715+++ src/webui/views/consumer.py 2018-05-30 16:21:15 +0000
716@@ -13,9 +13,9 @@
717
718 from django.conf import settings
719 from django.contrib import messages
720-from django.core.urlresolvers import reverse
721 from django.http import HttpResponseRedirect
722 from django.shortcuts import render
723+from django.urls import reverse
724 from django.utils.translation import ugettext_lazy as _
725 from django.views.decorators.csrf import csrf_exempt
726 from django_openid_auth.store import DjangoOpenIDStore
727
728=== modified file 'src/webui/views/devices.py'
729--- src/webui/views/devices.py 2018-02-09 20:56:16 +0000
730+++ src/webui/views/devices.py 2018-05-30 16:21:15 +0000
731@@ -10,10 +10,10 @@
732 from django.conf import settings
733 from django.contrib import messages
734 from django.contrib.auth.views import redirect_to_login
735-from django.core.urlresolvers import reverse
736 from django.http import HttpResponseRedirect
737 from django.shortcuts import get_object_or_404, render
738 from django.template.response import TemplateResponse
739+from django.urls import reverse
740 from django.utils.translation import ugettext_lazy as _
741 from django.views.generic import View
742 from gargoyle import gargoyle
743
744=== modified file 'src/webui/views/errors.py'
745--- src/webui/views/errors.py 2018-02-14 14:05:59 +0000
746+++ src/webui/views/errors.py 2018-05-30 16:21:15 +0000
747@@ -12,7 +12,7 @@
748 self.status_code = status
749 self.errormsg = errormsg
750
751- def __call__(self, request):
752+ def __call__(self, request, exception=None):
753 oopsid = request.environ.get('oops.report', {}).get('id', None)
754 atts = {
755 'request': request,
756
757=== modified file 'src/webui/views/i18n.py'
758--- src/webui/views/i18n.py 2018-02-09 20:56:16 +0000
759+++ src/webui/views/i18n.py 2018-05-30 16:21:15 +0000
760@@ -34,7 +34,7 @@
761 if lang not in settings.SUPPORTED_LANGUAGES:
762 raise Http404('Unsupported language')
763
764- if request.user.is_authenticated():
765+ if request.user.is_authenticated:
766 account = request.user
767 account.preferredlanguage = lang
768 account.save()
769
770=== modified file 'src/webui/views/registration.py'
771--- src/webui/views/registration.py 2018-02-15 11:27:21 +0000
772+++ src/webui/views/registration.py 2018-05-30 16:21:15 +0000
773@@ -7,7 +7,6 @@
774 from django.conf import settings
775 from django.contrib import auth, messages
776 from django.contrib.auth.decorators import login_required
777-from django.core.urlresolvers import reverse
778 from django.http import (
779 HttpResponseNotAllowed,
780 HttpResponseRedirect,
781@@ -15,6 +14,7 @@
782 )
783 from django.template.loader import render_to_string
784 from django.template.response import TemplateResponse
785+from django.urls import reverse
786 from django.utils.decorators import method_decorator
787 from django.utils.translation import ugettext_lazy as _
788 from django.views.decorators.http import require_http_methods
789
790=== modified file 'src/webui/views/ui.py'
791--- src/webui/views/ui.py 2018-05-10 20:20:47 +0000
792+++ src/webui/views/ui.py 2018-05-30 16:21:15 +0000
793@@ -11,7 +11,6 @@
794 from django.conf import settings
795 from django.contrib import auth, messages
796 from django.contrib.auth.decorators import login_required
797-from django.core.urlresolvers import reverse
798 from django.http import (
799 Http404,
800 HttpResponse,
801@@ -25,6 +24,7 @@
802 )
803 from django.template.loader import render_to_string
804 from django.template.response import TemplateResponse
805+from django.urls import reverse
806 from django.utils.decorators import method_decorator
807 from django.utils.http import urlquote
808 from django.utils.translation import ugettext_lazy as _