Re: Deprecate Cache.has_key()?

2016-02-01 Thread Tim Graham
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__. Proposal withdrawn. On Sunday, January 31, 2016 at 4:26:12 AM

Re: Deprecate Cache.has_key()?

2016-01-31 Thread Adam Johnson
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. On Saturday, January 30, 2016 at 12:34:14 PM UTC, Tim Graham wrote: > > Yes, but dict.has_key() is removed in Python 3. If

Re: Deprecate Cache.has_key()?

2016-01-30 Thread Tim Graham
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. On Friday, January 29, 2016 at 8:04:33 PM UTC-5, Curtis Maloney wrote: > > Isn't this so it complies with the dict

Re: Deprecate Cache.has_key()?

2016-01-29 Thread Curtis Maloney
Isn't this so it complies with the dict interface? True, it's discouraged now, but it's still there. On 30 January 2016 10:42:12 am LHDT, Tim Graham wrote: >Also the template BaseContext class has an undocumented has_key() >method. I >wonder if that can be removed

Re: Deprecate Cache.has_key()?

2016-01-29 Thread Tim Graham
Also the template BaseContext class has an undocumented has_key() method. I wonder if that can be removed without a deprecation? https://github.com/django/django/pull/6066 On Friday, January 29, 2016 at 6:11:54 PM UTC-5, Tim Graham wrote: > > Any opposition to deprecating Cache.has_key()? Cache

Deprecate Cache.has_key()?

2016-01-29 Thread Tim Graham
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'. -- You received this