summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2018-07-21 12:50:29 -0400
committerLeonard Richardson <leonardr@segfault.org>2018-07-21 12:50:29 -0400
commit58cffa003e82049b78f14db73518d000cd05e3d6 (patch)
tree7a81d6e9c18554c7e5e9fc1673113f3932f67dc9 /bs4/element.py
parentfebd6cea8cdd665a6f13c7040c3ff7d60d350e41 (diff)
Clarified the deprecation warning when accessing tag.fooTag, to cover
the possibility that you might really have been looking for a tag called 'fooTag'.
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bs4/element.py b/bs4/element.py
index f010833..c431a97 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -1106,8 +1106,10 @@ class Tag(PageElement):
# BS3: soup.aTag -> "soup.find("a")
tag_name = tag[:-3]
warnings.warn(
- '.%sTag is deprecated, use .find("%s") instead.' % (
- tag_name, tag_name))
+ '.%(name)sTag is deprecated, use .find("%(name)s") instead. If you really were looking for a tag called %(name)sTag, use .find("%(name)sTag")' % dict(
+ name=tag_name
+ )
+ )
return self.find(tag_name)
# We special case contents to avoid recursion.
elif not tag.startswith("__") and not tag == "contents":