diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-26 23:11:54 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-26 23:11:54 -0500 |
commit | a5f2ee72f16d0b6755ab84ddf2eff8e3d412e755 (patch) | |
tree | eae97ab6ff7fe186c308bb9910be56b58130a18b | |
parent | cb369db2e4a16816ae78ff6eff7d8d3393141569 (diff) |
Cleaned up decodeContents, and removed encodeContents, which isn't used.
-rw-r--r-- | beautifulsoup/element.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/beautifulsoup/element.py b/beautifulsoup/element.py index 3515d50..e6e7adb 100644 --- a/beautifulsoup/element.py +++ b/beautifulsoup/element.py @@ -609,7 +609,7 @@ class Tag(PageElement): indentTag = indent_level space = (' ' * (indentTag-1)) indentContents = indentTag + 1 - contents = self.decodeContents(pretty_print, indentContents, + contents = self.decode_contents(pretty_print, indentContents, eventual_encoding, substitute_html_entities) if self.hidden: @@ -648,18 +648,18 @@ class Tag(PageElement): def prettify(self, encoding=DEFAULT_OUTPUT_ENCODING): return self.encode(encoding, True) - def encodeContents(self, encoding=DEFAULT_OUTPUT_ENCODING, - pretty_print=False, indent_level=0, - replace_With_html_entities=False): - return self.decodeContents( - pretty_print, indent_level, substitute_html_entities).encode( - encoding) - - def decodeContents(self, pretty_print=False, indent_level=0, + def decode_contents(self, pretty_print=False, indent_level=0, eventual_encoding=DEFAULT_OUTPUT_ENCODING, substitute_html_entities=False): - """Renders the contents of this tag as a string in the given - encoding. If encoding is None, returns a Unicode string..""" + """Renders the contents of this tag as a Unicode string. + + :param eventual_encoding: The document is destined to be + encoded into this encoding. This method is _not_ + responsible for performing that encoding. This information + is passed in so that it can be substituted in if the + document contains a <META> tag that mentions the document's + encoding. + """ s=[] for c in self: text = None |