You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
Any opposition to deprecating Cache.has_key()? Cache already implements __contains__() so converting has_key() to "in" can be done with existing versions of Django. Anyone using flake8 will get a warning about has_key() usage: W601 .has_key() is deprecated, use 'in'.
Tim Graham
unread,
Jan 29, 2016, 6:42:12 PM1/29/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
Also the template BaseContext class has an undocumented has_key() method. I wonder if that can be removed without a deprecation?
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-d...@googlegroups.com, Tim Graham
Isn't this so it complies with the dict interface? True, it's discouraged now, but it's still there.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Tim Graham
unread,
Jan 30, 2016, 7:34:14 AM1/30/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
Yes, but dict.has_key() is removed in Python 3. If we started the deprecation in Django now, it would be scheduled for removal in Django 2.0 which also drops support for Python 2.
Adam Johnson
unread,
Jan 31, 2016, 4:26:12 AM1/31/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
Might be problematic for third-party cache backends which implement has_key and rely on __contains__ calling it - don't see how you can show the warning in that case.
Tim Graham
unread,
Feb 1, 2016, 1:25:29 PM2/1/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
We have django.utils.deprecation.RenameMethodsBase to help with that, but now I see that subclasses have this signature, `def has_key(self, key, version=None)`, so it doesn't seem the method can be replaced with __contains__.