Opened 12 years ago
Closed 11 years ago
#20083 closed Bug (worksforme)
Fix for #18985 makes it impossible to filter deprecation warnings
Reported by: | Aymeric Augustin | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | hv@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The following does nothing on Python >= 2.7 because warnings are piped into logging since [44046e8a]:
warnings.filterwarnings( 'error', r'django\.conf\.urls\.defaults is deprecated; use django\.conf\.urls instead', DeprecationWarning, r'django\.conf\.urls\.defaults')
That's a bit annoying.
Change History (5)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 11 years ago
Cc: | added |
---|
comment:5 by , 11 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Looking at the source code of the warnings
module, it seems that raising the exception precedes the showwarning
call, hence routing through logging should not affect error
filters. I've just added a test for this. But it may be that recent commits with addition of DeprecationWarning
subclasses for Django deprecations has also helped.
Note:
See TracTickets
for help on using tickets.
I agree. I ran into this same issue.