Merge lp:~glyphobet/python-webdav-lib/default into lp:python-webdav-lib

Proposed by Glyphobet
Status: Needs review
Proposed branch: lp:~glyphobet/python-webdav-lib/default
Merge into: lp:python-webdav-lib
Diff against target: 12 lines (+1/-1)
1 file modified
src/webdav/WebdavResponse.py (+1/-1)
To merge this branch: bzr merge lp:~glyphobet/python-webdav-lib/default
Reviewer Review Type Date Requested Status
DataFinderTeam Pending
Review via email: mp+149161@code.launchpad.net

Description of the change

sys.stdout always has an encoding attribute, unless it has been overridden with another object, as nosetests does, for example. In that case, sys.stdout.encoding will raise an AttributeError. This will make it not raise that error and fall back to 'ascii'.

To post a comment you must log in.

Unmerged revisions

41. By Glyphobet

sys.stdout always has an encoding attribute, unless it has been overridden with another object, as nosetests does, for example. In that case, sys.stdout.encoding will raise an AttributeError. This will make it not raise that error and fall back to 'ascii'.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/webdav/WebdavResponse.py'
2--- src/webdav/WebdavResponse.py 2012-12-14 23:08:04 +0000
3+++ src/webdav/WebdavResponse.py 2013-02-18 21:30:32 +0000
4@@ -110,7 +110,7 @@
5 key, len(value), ", ".join([prop[1] for prop in value.keys()]), value.errorCount)
6 else:
7 result += "Resource at %s returned " % key + unicode(value)
8- return result.encode(sys.stdout.encoding or "ascii", "replace")
9+ return result.encode(getattr(sys.stdout, "encoding", "ascii"), "replace")
10
11 def _scan(self, root):
12 for child in root.children:

Subscribers

People subscribed via source and target branches