summaryrefslogtreecommitdiff
path: root/beautifulsoup/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'beautifulsoup/__init__.py')
-rw-r--r--beautifulsoup/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/beautifulsoup/__init__.py b/beautifulsoup/__init__.py
index 5aa1406..53130e0 100644
--- a/beautifulsoup/__init__.py
+++ b/beautifulsoup/__init__.py
@@ -262,7 +262,7 @@ class BeautifulSoup(Tag):
def handle_data(self, data):
self.currentData.append(data)
- def decode(self, pretty_print=False, indent_level=0,
+ def decode(self, pretty_print=False,
eventual_encoding=DEFAULT_OUTPUT_ENCODING,
substitute_html_entities=False):
"""Returns a string or Unicode representation of this document.
@@ -275,8 +275,12 @@ class BeautifulSoup(Tag):
prefix = u'<?xml version="1.0"%s>\n' % encoding_part
else:
prefix = u''
+ if not pretty_print:
+ indent_level = None
+ else:
+ indent_level = 0
return prefix + super(BeautifulSoup, self).decode(
- pretty_print, indent_level, eventual_encoding,
+ indent_level, eventual_encoding,
substitute_html_entities)