~dobey/ubuntu/oneiric/ubuntu-sso-client/release-133

« back to all changes in this revision

Viewing changes to ubuntu_sso/networkstate.py

  • Committer: Ken VanDine
  • Date: 2010-09-09 15:03:00 UTC
  • mfrom: (11.1.3 ubuntu-sso-client-0.99.6)
  • Revision ID: ken.vandine@canonical.com-20100909150300-z0lnnumytp0493tf
Tags: 0.99.6-0ubuntu1
releasing version 0.99.6-0ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import dbus
21
21
 
22
 
from ubuntu_sso.logger import setupLogging
23
 
logger = setupLogging("ubuntu_sso.networkstate")
 
22
from ubuntu_sso.logger import setup_logging
 
23
logger = setup_logging("ubuntu_sso.networkstate")
24
24
 
25
25
# Values returned by the callback
26
26
ONLINE, OFFLINE, UNKNOWN = object(), object(), object()
27
27
 
28
 
nm_state_names = {
 
28
NM_STATE_NAMES = {
29
29
    ONLINE: "online",
30
30
    OFFLINE: "offline",
31
31
    UNKNOWN: "unknown",
46
46
class NetworkManagerState(object):
47
47
    """Checks the state of NetworkManager thru DBus."""
48
48
 
49
 
    def __init__(self, result_cb, dbus=dbus):
 
49
    def __init__(self, result_cb, dbus_module=dbus):
50
50
        """Initialize this instance with a result and error callbacks."""
51
51
        self.result_cb = result_cb
52
 
        self.dbus = dbus
 
52
        self.dbus = dbus_module
53
53
        self.state_signal = None
54
54
 
55
55
    def call_result_cb(self, state):
102
102
            nm_proxy.Get(NM_DBUS_INTERFACE, "State",
103
103
                         reply_handler=self.got_state,
104
104
                         error_handler=self.got_error)
105
 
        except Exception, e:
 
105
        except Exception, e:  # pylint: disable=W0703
106
106
            self.got_error(e)