From a5f2ee72f16d0b6755ab84ddf2eff8e3d412e755 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sat, 26 Feb 2011 23:11:54 -0500 Subject: Cleaned up decodeContents, and removed encodeContents, which isn't used. --- beautifulsoup/element.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'beautifulsoup/element.py') 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 tag that mentions the document's + encoding. + """ s=[] for c in self: text = None -- cgit v1.2.3