~ubuntu-branches/ubuntu/oneiric/ubuntuone-control-panel/oneiric

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/backend.py

* New upstream release:
  [ Alejandro J. Cura <alecu@canonical.com>]
    - Do not throw a webclient error when closing
      (LP: #845105).
  [ Natalia B. Bidart <natalia.bidart@canonical.com> ]
    - Removed all code related to Bookmarks (LP: #850142).
    - Replaces references to "Evolution" by "Thunderbird" (LP: #849494).
  [ Rodney Dawes <rodney.dawes@canonical.com> ]
    - Don't install a .desktop file for control panel
      (part of LP: #838778).
    - Point the indicator/Unity API at the installer .desktop file
      (part of LP: #838778).
    - Set the WMCLASS so Unity will fall back properly
      (part of LP: #838778).
    - Fix a few grammar mistakes (LP: #835093).
    - Don't show the "Get NGB free!" label on "Join now" button at all
      (LP: #819955).
* debian/control:
  - ubuntuone-control-panel-gtk depends now on ubuntuone-installer >= 2.0.0.
  - require ubuntuone-client >= 2.0.0.
  - require ubuntu-sso-client >= 1.4.0.
  - no longer install a .desktop file (will be installed by ubuntuone-installer).

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
MSG_KEY = 'message'
68
68
STATUS_KEY = 'status'
69
69
 
70
 
BOOKMARKS_PKG = 'xul-ext-bindwood'
71
 
CONTACTS_PKG = 'evolution-couchdb'
 
70
CONTACTS_PKG = 'thunderbird-couchdb'
72
71
 
73
72
 
74
73
def append_path_sep(path):
99
98
            result = yield f(instance, *args, **kwargs)
100
99
        except UnauthorizedError, e:
101
100
            logger.exception('process_unauthorized (clearing credentials):')
102
 
            yield instance.login_client.clear_credentials()
 
101
            yield instance.clear_credentials()
103
102
            raise e
104
103
 
105
104
        returnValue(result)
138
137
        self.sd_client = sd_client.SyncDaemonClient()
139
138
        self.wc = web_client_factory(self.get_credentials)
140
139
 
 
140
        logger.info('ControlBackend: instance started.')
 
141
 
141
142
    def _process_file_sync_status(self, status):
142
143
        """Process raw file sync status into custom format.
143
144
 
297
298
    @inlineCallbacks
298
299
    def get_credentials(self):
299
300
        """Find credentials."""
300
 
        if self._credentials is None:
 
301
        if not self._credentials:
301
302
            self._credentials = yield self.login_client.find_credentials()
302
303
        returnValue(self._credentials)
303
304
 
304
305
    @inlineCallbacks
 
306
    def clear_credentials(self):
 
307
        """Clear the credentials."""
 
308
        self._credentials = None
 
309
        yield self.login_client.clear_credentials()
 
310
 
 
311
    @inlineCallbacks
305
312
    def get_token(self):
306
313
        """Return the token from the credentials."""
307
314
        credentials = yield self.get_credentials()
308
315
        returnValue(credentials["token"])
309
316
 
 
317
    @log_call(logger.debug, with_args=False)
 
318
    @inlineCallbacks
 
319
    def login(self, email, password):
 
320
        """Login using 'email' and 'password'."""
 
321
        result = yield self.login_client.login_email_password(
 
322
                    email=email, password=password)
 
323
        # cache credentils
 
324
        self._credentials = result
 
325
        returnValue(result)
 
326
 
310
327
    @inlineCallbacks
311
328
    def device_is_local(self, device_id):
312
329
        """Return whether 'device_id' is the local devicew or not."""
480
497
        if is_local:
481
498
            logger.warning('remove_device: device is local! removing and '
482
499
                           'clearing credentials.')
483
 
            yield self.login_client.clear_credentials()
 
500
            yield self.clear_credentials()
484
501
 
485
502
        returnValue(device_id)
486
503
 
580
597
                               'list (%r).', vid, self._volumes[vid])
581
598
            self._volumes[vid] = share
582
599
 
 
600
            share[u'realpath'] = share[u'path']
583
601
            nicer_path = share[u'path'].replace(shares_dir, shares_dir_link)
584
602
            share[u'path'] = nicer_path
585
603
            share[u'subscribed'] = bool(share[u'subscribed'])
690
708
        result = []
691
709
        for rep in replications:
692
710
            dependency = ''
693
 
            if rep == replication_client.BOOKMARKS:
694
 
                dependency = BOOKMARKS_PKG
695
 
            elif rep == replication_client.CONTACTS:
 
711
            if rep == replication_client.CONTACTS:
696
712
                dependency = CONTACTS_PKG
697
713
 
698
714
            repd = {
717
733
        returnValue(replication_id)
718
734
 
719
735
    @log_call(logger.debug)
720
 
    def query_bookmark_extension(self):
721
 
        """True if the bookmark extension has been installed."""
722
 
        # still pending (LP: #673672)
723
 
        returnValue(False)
724
 
 
725
 
    @log_call(logger.debug)
726
 
    def install_bookmarks_extension(self):
727
 
        """Install the extension to sync bookmarks."""
728
 
        # still pending (LP: #673673)
729
 
        returnValue(None)
730
 
 
731
 
    @log_call(logger.debug)
732
736
    @inlineCallbacks
733
737
    def file_sync_settings_info(self):
734
738
        """Get the file sync settings info."""