Discussion on list:
https://groups.google.com/forum/#!searchin/django-
developers/having$20the$20app/django-developers/SLwh7zJmkTQ/RPUABdNYuCIJ
--
Ticket URL: <https://code.djangoproject.com/ticket/24553>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Pull request:
https://github.com/django/django/pull/4410
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:1>
Comment (by timgraham):
It might be a use case for `AdminSite.each_context()`. Could we merely add
the `AdminSite.get_app_list()` method (called `build_app_list()` in your
patch) and allow users to override `AdminSite.each_context()` if they want
that available in all their contexts?
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:2>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:3>
Comment (by rm_):
Replying to [comment:2 timgraham]:
> It might be a use case for `AdminSite.each_context()`. Could we merely
add the `AdminSite.get_app_list()` method (called `build_app_list()` in
your patch) and allow users to override `AdminSite.each_context()` if they
want that available in all their contexts?
My plan is to consume this data on django theme and really much like to
have it work out of the box without requiring user intervention. If that's
not possible i'll go with the each_context() route.
Settings needs better patch because some tests are failing.
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:4>
* needs_better_patch: 1 => 0
Comment:
Tests passes, the docs test not passing i think is not related to the
patchset as in some runs it did pass. One thing i am wondering about is to
don't call build_app_list() if is_popup() is true since it does not make
much sense to add it inside a popup. Flipping the needs improvement bits
to get some review exposure. What do you think?
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:5>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:6>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:7>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:8>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:9>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"bd53db5eab05099ae371348529c6428e0da95c6a" bd53db5]:
{{{
#!CommitTicketReference repository=""
revision="bd53db5eab05099ae371348529c6428e0da95c6a"
Fixed #24553 -- Added the list of available applications to
AdminSite.each_context()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:10>
* status: closed => new
* has_patch: 1 => 0
* resolution: fixed =>
* stage: Ready for checkin => Accepted
Comment:
Reopening due to test failures reported in #24798.
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:11>
* has_patch: 0 => 1
Comment:
Opened pull request here:
https://github.com/django/django/pull/4659
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:12>
Comment (by Tim Graham <timograham@…>):
In [changeset:"adf5d75af1418b044d7ea335896e75277da06b77" adf5d75a]:
{{{
#!CommitTicketReference repository=""
revision="adf5d75af1418b044d7ea335896e75277da06b77"
Refs #24553 -- Isolated admin_* tests.
This fixes a regression with runtests.py --reverse after
bd53db5eab05099ae371348529c6428e0da95c6a
We need to avoid leaking model registration in the default AdminSite.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:13>
* status: new => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:14>
* status: closed => new
* has_patch: 1 => 0
* resolution: fixed =>
Comment:
Still seeing two test failures with `$ ./runtests.py auth_tests`
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:15>
Comment (by rm_):
Looking into this, it looks like all the test without custom AdminSite
leaks auth models in the site breaking the two test classes using custom
ROOT_URLCONF that are failing.
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:16>
Comment (by timgraham):
There appears to be leakage of the URLs from `tests/auth_tests/urls.py`
into tests that use `ROOT_URLCONF='auth_tests.test_urls_admin'`. Couldn't
find the reason for this but traced it as far as
[https://github.com/django/django/blob/1046c8afecf719eee5a2aaa28b001e731f94100b/django/core/urlresolvers.py#L405-L410
RegexURLResolver.urlconf_module] which shows leakage with this version:
{{{
#!python
@property
def urlconf_module(self):
if isinstance(self.urlconf_name, six.string_types):
module = import_module(self.urlconf_name)
patterns = getattr(module, "urlpatterns")
print('---- %s ---- %s ' % (self.urlconf_name, patterns))
return module
else:
return self.urlconf_name
}}}
and:
`$ ./tests/runtests.py
auth_tests.test_views.ChangePasswordTest.test_password_change_fails_with_invalid_old_password
auth_tests.test_views.ChangelistTests.test_user_change_password`
While the second test is executing, you'll see the URLs from the first
test.
Because the default admin site is leaking into the second test, its logout
view is being called (`AdminSite.name` is 'admin' instead of
'auth_test_admin').
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:17>
* has_patch: 0 => 1
Comment:
Got it! PR here https://github.com/django/django/pull/4675
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:18>
Comment (by Tim Graham <timograham@…>):
In [changeset:"ae1efb853c159ae4747d105405694245f8508b4b" ae1efb8]:
{{{
#!CommitTicketReference repository=""
revision="ae1efb853c159ae4747d105405694245f8508b4b"
Refs #24553 -- Fixed urlpatterns leakage in auth_tests
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:19>
* status: new => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/24553#comment:20>