summaryrefslogtreecommitdiff
path: root/beautifulsoup/__init__.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-02-13 20:00:33 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2011-02-13 20:00:33 -0500
commit5aa0e5ba8ec6a590c673db54c60ff2a76544f14f (patch)
treebf0637e79bc667a1b5ae08ca4794df414f169992 /beautifulsoup/__init__.py
parent87a55b145f0a73e6fc9ede9a762d81d2527161b6 (diff)
parentbc97bb3a83ee9fb4c8e31d11069ccf1cda61d4ff (diff)
Fixed handling of doctypes and added tests for nonsensical declarations.
Diffstat (limited to 'beautifulsoup/__init__.py')
-rw-r--r--beautifulsoup/__init__.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/beautifulsoup/__init__.py b/beautifulsoup/__init__.py
index 4a7e18b..ddf51f9 100644
--- a/beautifulsoup/__init__.py
+++ b/beautifulsoup/__init__.py
@@ -222,11 +222,15 @@ class BeautifulStoneSoup(Tag):
not self.parseOnlyThese.search(currentData)):
return
o = containerClass(currentData)
- o.setup(self.currentTag, self.previous)
- if self.previous:
- self.previous.next = o
- self.previous = o
- self.currentTag.contents.append(o)
+ self.object_was_parsed(o)
+
+ def object_was_parsed(self, o):
+ """Add an object to the parse tree."""
+ o.setup(self.currentTag, self.previous)
+ if self.previous:
+ self.previous.next = o
+ self.previous = o
+ self.currentTag.contents.append(o)
def _popToTag(self, name, inclusivePop=True):