~alecu/ubuntuone-control-panel/the-outer-limits

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/replication_client.py

  • Committer: Natalia B. Bidart
  • Date: 2011-01-06 19:47:25 UTC
  • mto: This revision was merged to the branch mainline in revision 45.
  • Revision ID: natalia.bidart@canonical.com-20110106194725-jvipq0zb2v9wf4f3
Fixed lint issues.

Install button now reads 'Install now' instead of 'Ok'.

Replication client now launches the desktopcouch service in a thread.

All calls to the backend service made by the GUI are now not blocking.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
"""Client to use replication services."""
20
20
 
21
 
from twisted.internet.defer import inlineCallbacks, returnValue
 
21
from twisted.internet.defer import Deferred, inlineCallbacks, returnValue
22
22
 
23
23
from ubuntuone.controlpanel.logger import setup_logging
24
24
 
51
51
    """The replication can not be excluded since is already excluded."""
52
52
 
53
53
 
54
 
@inlineCallbacks
55
54
def get_replication_proxy(replication_module=None):
56
55
    """Return a proxy to the replication client."""
 
56
    d = Deferred()
57
57
    if replication_module is None:
58
58
        # delay import in case DC is not installed at module import time
59
59
        # Unable to import 'desktopcouch.application.replication_services'
61
61
        from desktopcouch.application.replication_services \
62
62
            import ubuntuone as replication_module
63
63
    try:
64
 
        result = yield replication_module.ReplicationExclusion()
 
64
        result = replication_module.ReplicationExclusion()
65
65
    except ValueError:
66
 
        raise NoPairingRecord()
 
66
        d.errback(NoPairingRecord())
67
67
    else:
68
 
        returnValue(result)
69
 
    assert result is not None
 
68
        d.callback(result)
 
69
 
 
70
    return d
70
71
 
71
72
 
72
73
@inlineCallbacks
80
81
def get_exclusions():
81
82
    """Retrieve the list of exclusions."""
82
83
    proxy = yield get_replication_proxy()
83
 
    result = yield proxy.all_exclusions()
 
84
    result = proxy.all_exclusions()
84
85
    returnValue(result)
85
86
 
86
87