Opened 5 years ago

Closed 4 years ago

#17848 closed Bug (fixed)

Template context processors cache needs to be restored after it is cleared

Reported by: Ryan Kaskel Owned by: ryan
Component: contrib.auth Version: 1.4-beta-1
Severity: Normal Keywords: tests
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

I contributed the portion of the patch for #16366 where context._standard_context_processors is set to None`.

Unfortunatley, I neglected to restore the cache as it was at the end of the test.

The effect of this is that cache is now wrong for the rest of my project (and will be for others) and other tests fail.

This patch fixes this.

Attachments (4)

17848.diff (1.6 KB) - added by Ryan Kaskel 5 years ago.
17848-1.diff (1.1 KB) - added by Ryan Kaskel 5 years ago.
just clear the cache again after the test
17848-2.diff (9.7 KB) - added by Claude Paroz 5 years ago.
Use the signal_changed approach
17848-3.diff (10.9 KB) - added by Claude Paroz 4 years ago.
Update patch for current trunk

Download all attachments as: .zip

Change History (13)

Changed 5 years ago by Ryan Kaskel

Attachment: 17848.diff added

comment:1 Changed 5 years ago by Claude Paroz

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

I think it would be easier to just empty the cache again at the end of the tests.

comment:2 Changed 5 years ago by Ryan Kaskel

You're right. That's much simpler.

Changed 5 years ago by Ryan Kaskel

Attachment: 17848-1.diff added

just clear the cache again after the test

comment:3 Changed 5 years ago by Preston Holmes

Triage Stage: UnreviewedReady for checkin

Just ran tests and they pass - this looks like a sane approach

Changed 5 years ago by Claude Paroz

Attachment: 17848-2.diff added

Use the signal_changed approach

comment:4 Changed 5 years ago by Claude Paroz

Triage Stage: Ready for checkinAccepted

I'd just like some other committer to judge if the signal_setting approach might be a little cleaner. I also changed TEMPLATE_CONTEXT_PROCESSORS overriding in other tests to be consistent.

comment:5 Changed 5 years ago by Aymeric Augustin

I'm not comfortable with large changes this close to 1.4 final. I think we could commit the first version now, and implement the signal_setting-based technique after 1.4.

comment:6 Changed 5 years ago by Claude Paroz

In [17736]:

Reset template context processors cache after tests. Refs #17848.

comment:7 Changed 5 years ago by Claude Paroz

Severity: Release blockerNormal

Severity back to normal. Patch using setting_changed signal will be applied later.

Changed 4 years ago by Claude Paroz

Attachment: 17848-3.diff added

Update patch for current trunk

comment:8 Changed 4 years ago by Claude Paroz

Note that currenlty, the test messages.SessionTest.test_middleware_disabled_fail_silently does not pass when it is run individually, which is a symptom of the context processors cache issue (fixed in the latest patch).

comment:9 Changed 4 years ago by Claude Paroz

Resolution: fixed
Status: newclosed

In [17885]:

Fixed #17848 -- Added setting_changed signal for cases when TEMPLATE_CONTEXT_PROCESSORS is overriden in tests.

Note: See TracTickets for help on using tickets.
Back to Top