~ubuntu-branches/ubuntu/karmic/ubuntuone-client/karmic

« back to all changes in this revision

Viewing changes to ubuntuone/oauthdesktop/main.py

  • Committer: Bazaar Package Importer
  • Author(s): Rodney Dawes
  • Date: 2009-08-26 12:15:00 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090826121500-rivjec5146epys62
Tags: 0.93.0-0ubuntu1
* New upstream release.
  - Fix crash with KeyError in __getitem__ (LP: #404934)
  - Fix fatal error constant occurrances (LP: #414635)
  - Fix ability to reauthorize (LP: #406897)
  - Get rid of animated icon, and false activity status (LP: #414925)
* Update Standards-Version to 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
        logger.debug("Calling auth.client.ensure_access_token in thread")
96
96
        deferToThread(client.ensure_access_token).addErrback(self.error_handler)
97
97
 
 
98
    def clear_token(self, realm, consumer_key):
 
99
        """Remove the currently stored OAuth token from the keyring."""
 
100
        self.realm = str(realm)
 
101
        self.consumer_key = str(consumer_key)
 
102
        (request_token_url, user_authorisation_url,
 
103
          access_token_url, consumer_secret) =  self.get_config_urls(self.realm)
 
104
        from ubuntuone.oauthdesktop.auth import AuthorisationClient
 
105
        client = AuthorisationClient(self.realm,
 
106
                                     request_token_url,
 
107
                                     user_authorisation_url,
 
108
                                     access_token_url,
 
109
                                     self.consumer_key, consumer_secret,
 
110
                                     callback_parent=self.got_token,
 
111
                                     callback_denied=self.got_denial,
 
112
                                     callback_notoken=self.got_no_token,
 
113
                                     callback_error=self.got_error)
 
114
        deferToThread(client.clear_token).addErrback(self.error_handler)
 
115
        
98
116
    def error_handler(self, failure):
99
117
        """Deal with errors returned from auth process"""
100
118
        logger.debug("Error returned from auth process")
239
257
        self.currently_authing = True
240
258
        self.processor.login(realm, consumer_key, do_login)
241
259
 
 
260
    @dbus.service.method(dbus_interface='com.ubuntuone.Authentication',
 
261
                         in_signature='ss', out_signature='')
 
262
    def clear_token(self, realm, consumer_key):
 
263
        """
 
264
        D-Bus method, exported over the bus, to clear the existing token.
 
265
        """
 
266
        self.processor.clear_token(realm, consumer_key)
 
267
 
242
268
    @dbus.service.signal(dbus_interface='com.ubuntuone.Authentication',
243
269
                                             signature='ss')
244
270
    def NewCredentials(self, realm, consumer_key):