Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(7)

Unified Diff: Lib/xml/etree/ElementInclude.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/xml/dom/pulldom.py ('k') | Makefile.pre.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/xml/etree/ElementInclude.py Tue Jul 26 09:37:46 2011 +0300
+++ b/Lib/xml/etree/ElementInclude.py Mon Jul 25 09:47:18 2011 -0400
@@ -67,7 +67,7 @@
#
# @param href Resource reference.
# @param parse Parse mode. Either "xml" or "text".
-# @param encoding Optional text encoding (UTF-8 by default for "text").
+# @param encoding Optional text encoding.
# @return The expanded resource. If the parse mode is "xml", this
# is an ElementTree instance. If the parse mode is "text", this
# is a Unicode string. If the loader fails, it can return None
@@ -75,14 +75,13 @@
# @throws IOError If the loader fails to load the resource.
def default_loader(href, parse, encoding=None):
+ file = open(href)
if parse == "xml":
- file = open(href, 'rb')
data = ElementTree.parse(file).getroot()
else:
- if not encoding:
- encoding = 'UTF-8'
- file = open(href, 'r', encoding=encoding)
data = file.read()
+ if encoding:
+ data = data.decode(encoding)
file.close()
return data
« no previous file with comments | « Lib/xml/dom/pulldom.py ('k') | Makefile.pre.in » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+