summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-05-21 12:26:35 -0400
committerLeonard Richardson <leonard.richardson@canonical.com>2011-05-21 12:26:35 -0400
commit728ff36cd480a02c562976c5279e5a41240c1bfb (patch)
treee7260a01e089b18bc7e18765ed3716ad96ec7710 /bs4/element.py
parent60630ce1ccd988bd449394c68d6eb817832c6e54 (diff)
Deprecated has_key in favor of has_attr.
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 10377e9..a9814e1 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -463,7 +463,7 @@ class Tag(PageElement):
attribute."""
return self.attrs.get(key, default)
- def has_key(self, key):
+ def has_attr(self, key):
return key in self.attrs
def __getitem__(self, key):
@@ -707,6 +707,10 @@ class Tag(PageElement):
def recursiveChildGenerator(self):
return self.recursive_children
+ # This was kind of misleading because has_key() (attributes) was
+ # different from __in__ (contents). has_key() is gone in Python 3,
+ # anyway.
+ has_key = has_attr
# Next, a couple classes to represent queries and their results.
class SoupStrainer(object):