[web/application] fix query log handling on python3

Writing bytes to a file opened in text mode doesn't work.

authorJulien Cristau <julien.cristau@logilab.fr>
changesetbd5ea6c74d85
branchdefault
phasedraft
hiddenyes
parent revision#2dafcdd19c99 pep8 bits
child revision#73d5f99c19d9 [test] convert a lgc-style generative test into unittest2-style
files modified by this revision
cubicweb/web/application.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1454944222 -3600
# Mon Feb 08 16:10:22 2016 +0100
# Node ID bd5ea6c74d85180b9f3a0bb3d7afbaf88a8cbe10
# Parent 2dafcdd19c9918f6d0bde86b6afdcaf07c1722b3
[web/application] fix query log handling on python3

Writing bytes to a file opened in text mode doesn't work.

diff --git a/cubicweb/web/application.py b/cubicweb/web/application.py
@@ -230,17 +230,16 @@
1                          result = ['\n'+'*'*80]
2                          result.append(req.url())
3                          result += ['%s %s -- (%.3f sec, %.3f CPU sec)' % q
4                                     for q in cnx.executed_queries]
5                          cnx.executed_queries = []
6 -                        self._query_log.write('\n'.join(result).encode(req.encoding))
7 +                        self._query_log.write('\n'.join(result))
8                          self._query_log.flush()
9                      except Exception:
10                          self.exception('error while logging queries')
11 
12 
13 -
14      def main_handle_request(self, req, path):
15          """Process an http request
16 
17          Arguments are:
18          - a Request object