Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #26263 -- Deprecated Context.has_key(). #6066

Merged
merged 1 commit into from Feb 23, 2016

Conversation

timgraham
Copy link
Member

Doesn't seem to be documented, but might need to go through a deprecation anyway? (at least a mention in the release notes would be added)
https://groups.google.com/d/topic/django-developers/QoMsYiBo_80/discussion

@timgraham
Copy link
Member Author

@aaugustin, @prestontimmons any opinion on this?

@prestontimmons
Copy link
Contributor

I'm neutral on this change. If we deprecate it, I do like that it lines up with the deprecation of Python 2 support.

@aaugustin
Copy link
Member

+1 on making this cleanup.

Considering that:

  • Context is essentially documented as a dict-like object
  • dict.has_key exists on Python 2
  • this method has been around "forever" (perhaps since before Django had an API stability policy)

I'm in favor of implementing a deprecation path. It doesn't look onerous.

@timgraham timgraham changed the title Removed Context.has_key() method. Fixed #26263 -- Deprecated Context.has_key(). Feb 22, 2016
self.assertEqual(a.has_key('a'), True)
self.assertEqual(a.has_key('b'), False)
self.assertEqual(b.has_key('a'), True)
self.assertEqual(b.has_key('b'), False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch looks good. Did you purposefully prefer assertEqual over assertTrue/assertFalse here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it's safer since assertTrue/False will pass for any truthy/falsey value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine

@timgraham timgraham merged commit cdbd874 into django:master Feb 23, 2016
@timgraham timgraham deleted the has-key-context branch February 23, 2016 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants