diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-18 07:06:43 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-18 07:06:43 -0500 |
commit | 0267ea2c652e3953b0c3fb372603466e506e7f20 (patch) | |
tree | c50738baadc13e3ee8cb3efa1f6a9e0f6b72431e | |
parent | e18400989c9182c749404b1723e9d0c7d045e259 (diff) |
Renamed recursiveChildGenerator to recursive_children.
-rw-r--r-- | CHANGELOG | 5 | ||||
-rw-r--r-- | beautifulsoup/element.py | 7 |
2 files changed, 10 insertions, 2 deletions
@@ -3,6 +3,11 @@ Methods have been renamed for comply with PEP 8. findAll is now find_all, and so on. Old names still work. + * findAll -> find_all + * childGenerator -> children + * recursiveChildGenerator -> recursive_children + + tag.string now operates recursively. If tag A contains a single tag B and nothing else, then A.string is the same as B.string. So: diff --git a/beautifulsoup/element.py b/beautifulsoup/element.py index 869be4d..8170250 100644 --- a/beautifulsoup/element.py +++ b/beautifulsoup/element.py @@ -686,7 +686,7 @@ class Tag(PageElement, Entities): callable that takes a string and returns whether or not the string matches for some custom definition of 'matches'. The same is true of the tag name.""" - generator = self.recursiveChildGenerator + generator = self.recursive_children if not recursive: generator = self.childGenerator return self._find_all(name, attrs, text, limit, generator, **kwargs) @@ -712,7 +712,7 @@ class Tag(PageElement, Entities): yield self.contents[i] raise StopIteration - def recursiveChildGenerator(self): + def recursive_children(self): if not len(self.contents): raise StopIteration stopNode = self._lastRecursiveChild().next @@ -720,6 +720,9 @@ class Tag(PageElement, Entities): while current is not stopNode: yield current current = current.next + # Old name for backwards compatibility + recursiveChildGenerator = recursive_children + # Next, a couple classes to represent queries and their results. class SoupStrainer: |