Merge lp:~syleam/openobject-client/5.0-fix-tse-problem into lp:openobject-client/5.0

Proposed by Christophe CHAUVET
Status: Needs review
Proposed branch: lp:~syleam/openobject-client/5.0-fix-tse-problem
Merge into: lp:openobject-client/5.0
Diff against target: None lines
To merge this branch: bzr merge lp:~syleam/openobject-client/5.0-fix-tse-problem
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+5416@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Fix TSE problem

957. By Christophe CHAUVET

[IMP]
 * After test with py2exe, changes from original file in py2exe repository

958. By Christophe CHAUVET

Redirect all output to a virtual /dev/null

Unmerged revisions

958. By Christophe CHAUVET

Redirect all output to a virtual /dev/null

957. By Christophe CHAUVET

[IMP]
 * After test with py2exe, changes from original file in py2exe repository

956. By Christophe CHAUVET

[MERGE]
 * approved

955. By Christophe CHAUVET

[FIX]
 * Fix the problem when use in Windows TSE mode
 * Because stderr is redirect on the program files path, in read only on tse mode
 * Only users Home are writable.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/openerp-client.py'
2--- bin/openerp-client.py 2009-02-02 14:48:35 +0000
3+++ bin/openerp-client.py 2009-04-09 20:32:05 +0000
4@@ -43,6 +43,7 @@
5 arguments = {}
6 if sys.platform == 'win32':
7 arguments['filename'] = os.path.join(os.environ['USERPROFILE'], 'openerp-client.log')
8+ import wintse
9
10 logging.basicConfig(**arguments)
11
12
13=== added file 'bin/wintse.py'
14--- bin/wintse.py 1970-01-01 00:00:00 +0000
15+++ bin/wintse.py 2009-04-09 20:32:05 +0000
16@@ -0,0 +1,68 @@
17+# -*- encoding: utf-8 -*-
18+##############################################################################
19+#
20+# OpenERP, Open Source Management Solution
21+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
22+# 2008-2009 Syleam Info Services
23+#
24+# This program is free software: you can redistribute it and/or modify
25+# it under the terms of the GNU General Public License as published by
26+# the Free Software Foundation, either version 3 of the License, or
27+# (at your option) any later version.
28+#
29+# This program is distributed in the hope that it will be useful,
30+# but WITHOUT ANY WARRANTY; without even the implied warranty of
31+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32+# GNU General Public License for more details.
33+#
34+# You should have received a copy of the GNU General Public License
35+# along with this program. If not, see <http://www.gnu.org/licenses/>.
36+#
37+##############################################################################
38+#
39+# This code provide by py2exe project
40+#
41+
42+import sys
43+
44+class Stderr(object):
45+ softspace = 0
46+ _file = None
47+ _error = None
48+ def write(self, text, alert=sys._MessageBox, fname=sys.executable + '.log'):
49+ if self._file is None and self._error is None:
50+ try:
51+ self._file = open(os.path.join(os.environ['USERPROFILE'], 'openerp-client.exe.log'), 'a')
52+ except Exception, details:
53+ self._error = details
54+ import atexit
55+ atexit.register(alert, 0,
56+ "The logfile '%s' could not be opened:\n %s" % \
57+ (fname, details),
58+ "Errors occurred")
59+ else:
60+ import atexit
61+ atexit.register(alert, 0,
62+ "See the logfile '%s' for details" % fname,
63+ "Errors occurred")
64+ if self._file is not None:
65+ self._file.write(text)
66+ self._file.flush()
67+ def flush(self):
68+ if self._file is not None:
69+ self._file.flush()
70+sys.stderr = Stderr()
71+#del sys._MessageBox
72+#del Stderr
73+
74+class Blackhole(object):
75+ softspace = 0
76+ def write(self, text):
77+ pass
78+ def flush(self):
79+ pass
80+sys.stdout = Blackhole()
81+#del Blackhole
82+#del sys
83+
84+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: