Skip to content

Commit 438a392

Browse files
committed
Make sure the view server output buffer accepts bytes (fixes #319)
1 parent ce406d9 commit 438a392

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

couchdb/view.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
log = logging.getLogger('couchdb.view')
2525

2626

27-
def run(input=sys.stdin, output=sys.stdout):
27+
def run(input=sys.stdin, output=None):
2828
r"""CouchDB view function handler implementation for Python.
2929
3030
:param input: the readable file-like object to read input from
3131
:param output: the writable file-like object to write output to
3232
"""
3333
functions = []
34+
if output is None:
35+
output = sys.stdout if sys.version_info[0] < 3 else sys.stdout.buffer
3436

3537
def _writejson(obj):
3638
obj = json.encode(obj)

0 commit comments

Comments
 (0)