Merge lp:~alecu/ubuntu-sso-client/split-nm into lp:ubuntu-sso-client
| Status: | Merged |
|---|---|
| Approved by: | Rodrigo Moya on 2010-07-27 |
| Approved revision: | 553 |
| Merged at revision: | 549 |
| Proposed branch: | lp:~alecu/ubuntu-sso-client/split-nm |
| Merge into: | lp:ubuntu-sso-client |
| Diff against target: |
314 lines (+300/-0) 3 files modified
bin/show_nm_state.py (+36/-0) ubuntu_sso/networkstate.py (+105/-0) ubuntu_sso/tests/test_networkstate.py (+159/-0) |
| To merge this branch: | bzr merge lp:~alecu/ubuntu-sso-client/split-nm |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Rodrigo Moya (community) | Approve on 2010-07-27 | ||
| Natalia Bidart | Approve on 2010-07-27 | ||
| John Lenton | 2010-07-22 | Approve on 2010-07-23 | |
|
Review via email:
|
|||
Commit Message
A module for online/offline detection, querying NetworkManager thru DBus.
Description of the Change
A module for online/offline detection, querying NetworkManager thru DBus.
| Rodrigo Moya (rodrigo-moya) wrote : | # |
Shouldn't this include the changes in auth.py to use the new networkstate object?
| Alejandro J. Cura (alecu) wrote : | # |
> Shouldn't this include the changes in auth.py to use the new networkstate
> object?
This just adds the code and tests to detect NM state.
Changes to the SSO login process are coming in a following branch.
- 552. By Alejandro J. Cura on 2010-07-23
-
docstring fixes
| Natalia Bidart (nataliabidart) wrote : | # |
If network manager is not installed, I get:
nessita@
ERROR:dbus.
Traceback (most recent call last):
File "/usr/lib/
*message.
File "/home/
self.
File "/home/
self.
File "bin/show_
raise error
dbus.exceptions
nessita@
Is that the expected behavior?
- 553. By Alejandro J. Cura on 2010-07-26
-
state will be reported as UNKNOWN when NM is not installed or there is a dbus problem
| Alejandro J. Cura (alecu) wrote : | # |
Simplified the interface of this module following Naty's comment. Tested on Maverick, with NM installed and uninstalled too. With connman installed it currently reports "unknown" as the state; this should be fixed in a later branch.
| Natalia Bidart (nataliabidart) wrote : | # |
> Simplified the interface of this module following Naty's comment. Tested on
> Maverick, with NM installed and uninstalled too. With connman installed it
> currently reports "unknown" as the state; this should be fixed in a later
> branch.
Much better!

wrap a try/finally around the print in got_state, and maybe docstrings to
got_state and got_error in show_nm_state. And, lovely.
review approve
On Thu, Jul 22, 2010 at 10:55:56PM -0000, Alejandro J. Cura wrote:
> Alejandro J. Cura has proposed merging lp:~alecu/ubuntu-sso-client/split-nm into lp:ubuntu-sso-client.
>
> Requested reviews:
> Ubuntu One hackers (ubuntuone-hackers)
>
>
> A module for online/offline detection, querying NetworkManager thru DBus.
> === added file 'bin/show_ nm_state. py' nm_state. py 1970-01-01 00:00:00 +0000 nm_state. py 2010-07-22 22:55:54 +0000 www.gnu. org/licenses/>. set_as_ default= True) sso.networkstat e import NetworkManagerS tate, nm_state_names names[state] tate(got_ state, got_error) online_ state() sso/auth. py' basejoin( self.type + ":" + url, newurl) sso/networkstat e.py' sso/networkstat e.py 1970-01-01 00:00:00 +0000 sso/networkstat e.py 2010-07-22 22:55:54 +0000
> --- bin/show_
> +++ bin/show_
> @@ -0,0 +1,36 @@
> +# show_nm_state - Show the state of the NetworkManager daemon
> +#
> +# Author: Alejandro J. Cura <email address hidden>
> +#
> +# Copyright 2010 Canonical Ltd.
> +#
> +# This program is free software: you can redistribute it and/or modify it
> +# under the terms of the GNU General Public License version 3, as published
> +# by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it will be useful, but
> +# WITHOUT ANY WARRANTY; without even the implied warranties of
> +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
> +# PURPOSE. See the GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License along
> +# with this program. If not, see <http://
> +
> +from dbus.mainloop.glib import DBusGMainLoop
> +DBusGMainLoop(
> +import gobject
> +loop = gobject.MainLoop()
> +
> +from ubuntu_
> +
> +def got_state(state):
> + print nm_state_
> + loop.quit()
> +
> +def got_error(error):
> + loop.quit()
> + raise error
> +
> +nms = NetworkManagerS
> +nms.find_
> +loop.run()
>
> === modified file 'ubuntu_
> --- ubuntu_sso/auth.py 2010-06-10 14:34:40 +0000
> +++ ubuntu_sso/auth.py 2010-07-22 22:55:54 +0000
> @@ -94,7 +94,7 @@
> fp.close()
> # In case the server sent a relative URL, join with original:
> newurl = urllib.
> -
> +
> # pass data if present when we redirect
> if data:
> return self.open(newurl, data)
>
> === added file 'ubuntu_
> --- ubuntu_
> +++ ubuntu_
> @@ -0,0 +1,114 @@
> +# networkstate - detect the current state of the network
> +#
> +# Author: Alejandro J. Cura <email address hidden>
> +#
> +# Copyright 2010 Canonical Ltd.
> +#
> +# This program is free software: you can redistribute it and/or modify it
> +# under the terms of the GNU General Public License version 3, as published
> +# by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it will be useful, but
> +# WITHOUT ANY WARRANTY; without even the implied warranties of
> +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
> +# PURPOSE. See the GNU General Public License for more details.
> +#
> +# You shou...