[Django] #26460: Don't call ``warnings.warn`` for each invalid character in a caching key

2 views
Skip to first unread message

Django

unread,
Apr 4, 2016, 2:29:43 PM4/4/16
to django-...@googlegroups.com
#26460: Don't call ``warnings.warn`` for each invalid character in a caching key
-------------------------------+--------------------
Reporter: suligap | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
BaseCache.validate_key() will call `warnings.warn()`
[https://github.com/django/django/blob/15a20dc9aff1bd8a055ee7c322631b3ca4d1c474/django/core/cache/backends/base.py#L240-L244
for each invalid character in the key]. This is not a big issue since only
one warning will appear but it is unnecessary.

--
Ticket URL: <https://code.djangoproject.com/ticket/26460>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 4, 2016, 2:35:48 PM4/4/16
to django-...@googlegroups.com
#26460: Don't call ``warnings.warn`` for each invalid character in a caching key
-------------------------------+--------------------------------------

Reporter: suligap | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by suligap):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> BaseCache.validate_key() will call `warnings.warn()`
> [https://github.com/django/django/blob/15a20dc9aff1bd8a055ee7c322631b3ca4d1c474/django/core/cache/backends/base.py#L240-L244
> for each invalid character in the key]. This is not a big issue since
> only one warning will appear but it is unnecessary.

New description:

BaseCache.validate_key() will call `warnings.warn()`
[https://github.com/django/django/blob/15a20dc9aff1bd8a055ee7c322631b3ca4d1c474/django/core/cache/backends/base.py#L240-L244
for each invalid character in the key]. This is not a big issue since only
one warning will appear but it is unnecessary.

Fixed in https://github.com/django/django/pull/6414

--

--
Ticket URL: <https://code.djangoproject.com/ticket/26460#comment:1>

Django

unread,
Apr 4, 2016, 2:43:14 PM4/4/16
to django-...@googlegroups.com
#26460: Don't call ``warnings.warn`` for each invalid character in a caching key
-------------------------------------+-------------------------------------
Reporter: suligap | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by charettes):

* type: Uncategorized => Cleanup/optimization
* version: 1.9 => master
* component: Uncategorized => Core (Cache system)
* stage: Unreviewed => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26460#comment:2>

Django

unread,
Apr 4, 2016, 3:21:10 PM4/4/16
to django-...@googlegroups.com
#26460: Don't call ``warnings.warn`` for each invalid character in a caching key
-------------------------------------+-------------------------------------
Reporter: suligap | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette <charettes@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"d356bb653f4d90ae9809e5a051791ded39010c38" d356bb6]:
{{{
#!CommitTicketReference repository=""
revision="d356bb653f4d90ae9809e5a051791ded39010c38"
Fixed #26460 -- Issued a single warning for invalid cache key
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26460#comment:3>

Reply all
Reply to author
Forward
0 new messages