~mvo/ubuntu-sso-client/strawman-lp711413

« back to all changes in this revision

Viewing changes to ubuntu_sso/main.py

  • Committer: Tarmac
  • Author(s): Natalia B. Bidart
  • Date: 2011-01-05 14:02:20 UTC
  • mfrom: (664.3.3 really-errback-on-error)
  • Revision ID: tarmac-20110105140220-gvw0kfat8437b8je
On error, {find,clear,store}_credentials send proper CredentialsError signal (LP: #696676).

Show diffs side-by-side

added added

removed removed

Lines of Context:
436
436
        result[DENIAL_CB_KEY] = self.AuthorizationDenied
437
437
        return result
438
438
 
 
439
    def _process_failure(self, failure, app_name):
 
440
        """Process the 'failure' and emit CredentialsError."""
 
441
        self.CredentialsError(app_name, except_to_errdict(failure.value))
 
442
 
439
443
    @dbus.service.signal(DBUS_CREDENTIALS_IFACE, signature='s')
440
444
    def AuthorizationDenied(self, app_name):
441
445
        """Signal thrown when the user denies the authorization."""
496
500
        d = obj.find_credentials()
497
501
        # pylint: disable=E1101
498
502
        d.addCallback(success_cb)
499
 
        d.addErrback(self.CredentialsError)
 
503
        d.addErrback(self._process_failure, app_name)
500
504
 
501
505
    @dbus.service.method(dbus_interface=DBUS_CREDENTIALS_IFACE,
502
506
                         in_signature='sa{ss}', out_signature='')
513
517
        d = obj.clear_credentials()
514
518
        # pylint: disable=E1101
515
519
        d.addCallback(lambda _: self.CredentialsCleared(app_name))
516
 
        d.addErrback(self.CredentialsError)
 
520
        d.addErrback(self._process_failure, app_name)
517
521
 
518
522
    @dbus.service.method(dbus_interface=DBUS_CREDENTIALS_IFACE,
519
523
                         in_signature='sa{ss}', out_signature='')
532
536
        d = obj.store_credentials(args)
533
537
        # pylint: disable=E1101
534
538
        d.addCallback(lambda _: self.CredentialsStored(app_name))
535
 
        d.addErrback(self.CredentialsError)
 
539
        d.addErrback(self._process_failure, app_name)
536
540
 
537
541
    @dbus.service.method(dbus_interface=DBUS_CREDENTIALS_IFACE,
538
542
                         in_signature='sa{ss}', out_signature='')