Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

bug 1461350: Simplify test client #4793

Merged
merged 2 commits into from
May 18, 2018
Merged

Conversation

jwhitlock
Copy link
Contributor

With the LocaleMiddleware, the default is to include the locale prefix in URLs, so the LocalizingMixin and LocalizingClient are no longer needed.

The SessionAwareClient included code from Django 1.7, and was probably added when MDN was on Django 1.4 or earlier, and is included in the default 1.8 test client:

https://github.com/django/django/blob/6a0dc2176f4ebf907e124d433411e52bba39a28e/django/test/client.py#L411-L426

With the Django-based LocaleMiddleware, all URLs get a locale prefix by
default, so the LocalizingClient and the LocalizingMixin no longer needed
to ensure locale-prefixed URLs are used in tests.
This functionality was added to the base test client in Django 1.7.
@jwhitlock jwhitlock requested review from jezdez and escattone and removed request for jezdez May 17, 2018 22:21
@jezdez
Copy link
Contributor

jezdez commented May 17, 2018

Yep I can confirm this was code added to bridge the gap until modern Django is used.

Copy link
Contributor

@escattone escattone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jwhitlock!

@escattone escattone merged commit c4de4b1 into mdn:master May 18, 2018
@jwhitlock jwhitlock deleted the test-client-1461350 branch May 18, 2018 21:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants