Code

Opened 2 years ago

Closed 2 years ago

#17848 closed Bug (fixed)

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

Reported by: ryankask 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 ryankask 2 years ago.
17848-1.diff (1.1 KB) - added by ryankask 2 years ago.
just clear the cache again after the test
17848-2.diff (9.7 KB) - added by claudep 2 years ago.
Use the signal_changed approach
17848-3.diff (10.9 KB) - added by claudep 2 years ago.
Update patch for current trunk

Download all attachments as: .zip

Change History (13)

Changed 2 years ago by ryankask

comment:1 Changed 2 years ago by claudep

  • 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 2 years ago by ryankask

You're right. That's much simpler.

Changed 2 years ago by ryankask

just clear the cache again after the test

comment:3 Changed 2 years ago by ptone

  • Triage Stage changed from Unreviewed to Ready for checkin

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

Changed 2 years ago by claudep

Use the signal_changed approach

comment:4 Changed 2 years ago by claudep

  • Triage Stage changed from Ready for checkin to Accepted

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 2 years ago by aaugustin

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 2 years ago by claudep

In [17736]:

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

comment:7 Changed 2 years ago by claudep

  • Severity changed from Release blocker to Normal

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

Changed 2 years ago by claudep

Update patch for current trunk

comment:8 Changed 2 years ago by claudep

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 2 years ago by claudep

  • Resolution set to fixed
  • Status changed from new to closed

In [17885]:

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.