#19221: Cache keys can't be integers
-------------------------------------+------------------------------------
Reporter: mhsparks | Owner: nobody
Type: Bug | Status: new
Component: Core (Cache system) | Version: master
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Comment (by aaugustin):
This is another case of Django's source historically abusing
`smart_bytes`, which makes integers work where they shouldn't. The docs
don't promise anything and the cache keys are clearly intended to be
strings.
I recently had the same problem in `HttpResponse`. I ended up implementing
explicit support for integers because it was tested, but it's probably
going to be deprecated in the long run.
In this case, I believe that `cache.get(42)` and `cache.get('42')`
shouldn't be the same -- this isn't PHP! In Django 1.4, they are. I'm +0
on classifying this as a bugfix, and maybe documenting it as a backwards
incompatible change.
--
Ticket URL: <https://code.djangoproject.com/ticket/19221#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.