Merge lp:~ralsina/ubuntu-sso-client/no-more-stderr into lp:ubuntu-sso-client

Proposed by Roberto Alsina
Status: Work in progress
Proposed branch: lp:~ralsina/ubuntu-sso-client/no-more-stderr
Merge into: lp:ubuntu-sso-client
Diff against target: 52 lines (+20/-5)
1 file modified
bin/windows-ubuntu-sso-login (+20/-5)
To merge this branch: bzr merge lp:~ralsina/ubuntu-sso-client/no-more-stderr
Reviewer Review Type Date Requested Status
Ubuntu One hackers Pending
Review via email: mp+73718@code.launchpad.net

Commit message

Make SSO not print to stderr.

Description of the change

Make SSO not print to stderr.

To post a comment you must log in.

Unmerged revisions

764. By Roberto Alsina

Avoid using stderr

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/windows-ubuntu-sso-login'
2--- bin/windows-ubuntu-sso-login 2011-07-22 22:00:45 +0000
3+++ bin/windows-ubuntu-sso-login 2011-09-01 20:16:23 +0000
4@@ -22,6 +22,25 @@
5 # pylint: disable=C0103, E1101, F0401
6 import sys
7
8+
9+# This has to be done as early as possible
10+from ubuntu_sso.logger import setup_logging
11+
12+logger = setup_logging("windows-ubuntu-sso-login")
13+
14+
15+# See python bug http://bugs.python.org/issue11705
16+def create_closure(logger):
17+ def handleException(excType, excValue, traceback):
18+ logger.error("Uncaught exception",
19+ exc_info=(excType, excValue, traceback))
20+ return handleException
21+sys.excepthook = create_closure(logger)
22+# On windows, we don't want to log to stderr when DEBUG is set
23+# Or else, binaries will break when the user has it set.
24+sys.stderr = sys.stdout
25+
26+
27 from PyQt4 import QtGui
28 # need to create the QApplication before installing the reactor
29 app = QtGui.QApplication(sys.argv)
30@@ -33,7 +52,6 @@
31 from twisted.internet.task import LoopingCall
32 from twisted.python import log
33
34-from ubuntu_sso.logger import setup_logging
35 from ubuntu_sso.main.windows import (
36 CredentialsManagement,
37 LOCALHOST,
38@@ -45,13 +63,10 @@
39 from ubuntu_sso.utils import tcpactivation
40
41
42-logger = setup_logging("windows-ubuntu-sso-login")
43-
44-
45 def add_timeout(interval, callback, *args, **kwargs):
46 """Add a timeout callback as a task."""
47 time_out_task = LoopingCall(callback, *args, **kwargs)
48- time_out_task.start(interval/1000, now=False)
49+ time_out_task.start(interval / 1000, now=False)
50
51
52 @defer.inlineCallbacks

Subscribers

People subscribed via source and target branches