Merge lp:~diegosarmentero/ubuntuone-client/refactor-session into lp:ubuntuone-client

Proposed by Diego Sarmentero on 2012-04-27
Status: Merged
Approved by: Manuel de la Peña on 2012-04-30
Approved revision: 1231
Merged at revision: 1230
Proposed branch: lp:~diegosarmentero/ubuntuone-client/refactor-session
Merge into: lp:ubuntuone-client
Diff against target: 158 lines (+35/-34)
7 files modified
run-tests.bat (+1/-1)
tests/platform/session/__init__.py (+27/-0)
tests/platform/session/test_linux.py (+1/-1)
ubuntuone/platform/session/__init__.py (+4/-4)
ubuntuone/platform/session/linux.py (+1/-14)
ubuntuone/platform/session/windows.py (+1/-13)
ubuntuone/platform/windows/__init__.py (+0/-1)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-client/refactor-session
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve on 2012-04-30
dobey (community) 2012-04-27 Approve on 2012-04-27
Review via email: mp+103933@code.launchpad.net

Commit Message

- Refactor platform/session (LP: #989132).

To post a comment you must log in.
1231. By Diego Sarmentero on 2012-04-27

Fixing run-tests.bat

dobey (dobey) :
review: Approve
Manuel de la Peña (mandel) wrote :

Great, moving to a diff platform :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run-tests.bat'
2--- run-tests.bat 2012-04-20 14:43:29 +0000
3+++ run-tests.bat 2012-04-27 19:41:18 +0000
4@@ -74,7 +74,7 @@
5 COPY windows\clientdefs.py ubuntuone\clientdefs.py
6 COPY windows\logging.conf data\logging.conf
7 :: execute the tests with a number of ignored linux only modules
8-"%PYTHONEXEPATH%" "%TRIALPATH%" --reactor=twisted -c -p tests\platform\linux %PARAMS% tests
9+"%PYTHONEXEPATH%" "%TRIALPATH%" --reactor=twisted -c -p tests\platform\linux -i test_linux.py %PARAMS% tests
10
11 IF %SKIPLINT% == 1 (
12 ECHO Skipping style checks
13
14=== added directory 'tests/platform/session'
15=== added file 'tests/platform/session/__init__.py'
16--- tests/platform/session/__init__.py 1970-01-01 00:00:00 +0000
17+++ tests/platform/session/__init__.py 2012-04-27 19:41:18 +0000
18@@ -0,0 +1,27 @@
19+# Copyright 2011-2012 Canonical Ltd.
20+#
21+# This program is free software: you can redistribute it and/or modify it
22+# under the terms of the GNU General Public License version 3, as published
23+# by the Free Software Foundation.
24+#
25+# This program is distributed in the hope that it will be useful, but
26+# WITHOUT ANY WARRANTY; without even the implied warranties of
27+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
28+# PURPOSE. See the GNU General Public License for more details.
29+#
30+# You should have received a copy of the GNU General Public License along
31+# with this program. If not, see <http://www.gnu.org/licenses/>.
32+#
33+# In addition, as a special exception, the copyright holders give
34+# permission to link the code of portions of this program with the
35+# OpenSSL library under certain conditions as described in each
36+# individual source file, and distribute linked combinations
37+# including the two.
38+# You must obey the GNU General Public License in all respects
39+# for all of the code used other than OpenSSL. If you modify
40+# file(s) with this exception, you may extend this exception to your
41+# version of the file(s), but you are not obligated to do so. If you
42+# do not wish to do so, delete this exception statement from your
43+# version. If you delete this exception statement from all source
44+# files in the program, then also delete it here.
45+"""Platform/Session test code."""
46
47=== renamed file 'tests/platform/linux/test_session.py' => 'tests/platform/session/test_linux.py'
48--- tests/platform/linux/test_session.py 2012-04-09 20:07:05 +0000
49+++ tests/platform/session/test_linux.py 2012-04-27 19:41:18 +0000
50@@ -37,7 +37,7 @@
51 from twisted.internet.defer import inlineCallbacks
52 from ubuntuone.devtools.testcases.dbus import DBusTestCase
53
54-from ubuntuone.platform.linux import session
55+from ubuntuone.platform import session
56
57 INHIBIT_ALL = (session.INHIBIT_LOGGING_OUT |
58 session.INHIBIT_USER_SWITCHING |
59
60=== added directory 'ubuntuone/platform/session'
61=== renamed file 'ubuntuone/platform/session.py' => 'ubuntuone/platform/session/__init__.py'
62--- ubuntuone/platform/session.py 2012-04-09 20:07:05 +0000
63+++ ubuntuone/platform/session/__init__.py 2012-04-27 19:41:18 +0000
64@@ -39,11 +39,11 @@
65
66
67 if sys.platform == "win32":
68- from ubuntuone.platform.windows import session
69- source = session
70+ from ubuntuone.platform.session import windows
71+ source = windows
72 else:
73- from ubuntuone.platform.linux import session
74- source = session
75+ from ubuntuone.platform.session import linux
76+ source = linux
77 SESSION_MANAGER_BUSNAME = source.SESSION_MANAGER_BUSNAME
78 SESSION_MANAGER_IFACE = source.SESSION_MANAGER_IFACE
79 SESSION_MANAGER_PATH = source.SESSION_MANAGER_PATH
80
81=== renamed file 'ubuntuone/platform/linux/session.py' => 'ubuntuone/platform/session/linux.py'
82--- ubuntuone/platform/linux/session.py 2012-04-09 20:07:05 +0000
83+++ ubuntuone/platform/session/linux.py 2012-04-27 19:41:18 +0000
84@@ -1,6 +1,4 @@
85-# ubuntuone.platform.linux.session
86-#
87-# Author: Alejandro J. Cura <alecu@canonical.com>
88+# -*- coding: utf-8 *-*
89 #
90 # Copyright 2011-2012 Canonical Ltd.
91 #
92@@ -34,12 +32,6 @@
93
94 from twisted.internet import defer
95
96-INHIBIT_LOGGING_OUT = 1
97-INHIBIT_USER_SWITCHING = 2
98-INHIBIT_SUSPENDING_COMPUTER = 4
99-INHIBIT_SESSION_IDLE = 8
100-INHIBIT_LOGOUT_SUSPEND = INHIBIT_LOGGING_OUT | INHIBIT_SUSPENDING_COMPUTER
101-
102 SESSION_MANAGER_BUSNAME = "org.gnome.SessionManager"
103 SESSION_MANAGER_IFACE = "org.gnome.SessionManager"
104 SESSION_MANAGER_PATH = "/org/gnome/SessionManager"
105@@ -82,8 +74,3 @@
106 reply_handler=lambda: d.callback(self),
107 error_handler=d.errback)
108 return d
109-
110-
111-def inhibit_logout_suspend(reason):
112- """Inhibit the suspend and logout. The result can be cancelled."""
113- return Inhibitor().inhibit(INHIBIT_LOGOUT_SUSPEND, reason)
114
115=== renamed file 'ubuntuone/platform/windows/session.py' => 'ubuntuone/platform/session/windows.py'
116--- ubuntuone/platform/windows/session.py 2012-04-09 20:07:05 +0000
117+++ ubuntuone/platform/session/windows.py 2012-04-27 19:41:18 +0000
118@@ -1,5 +1,4 @@
119-#
120-# Author: Alejandro J. Cura <alecu@canonical.com>
121+# -*- coding: utf-8 *-*
122 #
123 # Copyright 2011-2012 Canonical Ltd.
124 #
125@@ -31,12 +30,6 @@
126
127 from twisted.internet import defer
128
129-INHIBIT_LOGGING_OUT = 1
130-INHIBIT_USER_SWITCHING = 2
131-INHIBIT_SUSPENDING_COMPUTER = 4
132-INHIBIT_SESSION_IDLE = 8
133-INHIBIT_LOGOUT_SUSPEND = INHIBIT_LOGGING_OUT | INHIBIT_SUSPENDING_COMPUTER
134-
135
136 class Inhibitor(object):
137 """An object representing an inhibition, that can be cancelled."""
138@@ -48,8 +41,3 @@
139 def cancel(self):
140 """Cancel the inhibition for the current cookie."""
141 return defer.succeed(None)
142-
143-
144-def inhibit_logout_suspend(reason):
145- """Inhibit the suspend and logout. The result can be cancelled."""
146- return Inhibitor().inhibit(INHIBIT_LOGOUT_SUSPEND, reason)
147
148=== modified file 'ubuntuone/platform/windows/__init__.py'
149--- ubuntuone/platform/windows/__init__.py 2012-04-09 20:07:05 +0000
150+++ ubuntuone/platform/windows/__init__.py 2012-04-27 19:41:18 +0000
151@@ -44,7 +44,6 @@
152 import messaging
153 import notification
154 import os_helper
155-import session
156
157 from ubuntuone.platform.windows.os_helper import (
158 access,

Subscribers

People subscribed via source and target branches