[MERGE] don't crash with old versions of dbus-python

Daniel Schierbeck daniel.schierbeck at gmail.com
Sun Jun 1 21:13:43 BST 2008


Awesome work, Sabin!

bb:approve

On Sun, 2008-06-01 at 10:51 +0300, Sabin Iacob wrote:
> fixing the seahorse detection fix: it appears that 
> DBusException.get_bus_name was introduced in dbus-python 0.81.1, and 
> there are still older versions around
> 
> there is a complaint about this so far in bug 
> https://bugs.launchpad.net/bugs/235668, but the reporter is not very 
> cooperative, so if anyone else can test this, it would be great.
> 
> P.S. and offtopic: it appears that bb has taken a vacation :)
> 
> plain text document attachment (bug228922-491.patch)
> # Bazaar merge directive format 2 (Bazaar 0.90)
> # revision_id: iacobs at m0n5t3r.info-20080529094848-wvr1opflqclhjuur
> # target_branch: file:///home/iacobs/tmp/bzr-gtk/
> # testament_sha1: 3bb4914340dd13e6c189f617bfc37e759cd736b8
> # timestamp: 2008-06-01 10:16:45 +0300
> # base_revision_id: iacobs at m0n5t3r.info-20080526115059-\
> #   i2gfnwaldolu5y31
> # 
> # Begin patch
> === modified file 'seahorse.py'
> --- seahorse.py	2008-05-23 08:23:59 +0000
> +++ seahorse.py	2008-05-29 09:48:48 +0000
> @@ -30,15 +30,19 @@
>  
>  bus = dbus.SessionBus()
>  
> -try: 
> -    crypto = dbus.Interface(bus.get_object(BUS_NAME, CRYPTO_PATH), 
> -                            CRYPTO_INTERFACE)
> -    openpgp = dbus.Interface(bus.get_object(BUS_NAME, OPENPGP_PATH),
> -                             OPENPGP_INTERFACE)
> -except dbus.exceptions.DBusException, e:
> -    if e.get_dbus_name() == 'org.freedesktop.DBus.Error.ServiceUnknown':
> -        raise ImportError
> -    raise
> +if hasattr(bus, 'list_activatable_names'):
> +    bus_names = bus.list_activatable_names()
> +else:
> +    bus_object = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
> +    bus_names = bus_object.ListNames(dbus_interface='org.freedesktop.DBus')
> +
> +if BUS_NAME not in bus_names:
> +    raise ImportError
> +
> +crypto = dbus.Interface(bus.get_object(BUS_NAME, CRYPTO_PATH), 
> +                        CRYPTO_INTERFACE)
> +openpgp = dbus.Interface(bus.get_object(BUS_NAME, OPENPGP_PATH),
> +                         OPENPGP_INTERFACE)
>  
>  FLAG_VALID = 0x0001
>  FLAG_CAN_ENCRYPT = 0x0002
> 
> # Begin bundle
> IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWW4bW5cAAqp/gEAQBgBR5///
> f+feIL////BQBYx4ACy2lFKKBCSSamNJhBPUafolNGxT1DajIGagw1PUekZDjJkyYjEwAmTBMgBo
> wjAEMAlNRpJ6o9TE00xBpkAaAANNGmINADjJkyYjEwAmTBMgBowjAEMAkkTEaBGICZMU9U/RNNR7
> Uhp5TTTTQNA0eHHyYrypt+7uLZCM017MYeKgU6YVYyuhGDzACdXXibCompUTopGpQzTGkRKfXCWw
> 8bCEnMjZ4vUBDwgy05Zy58ZasqTLGOAdIlAls1z9aWYnpSJC6ozvPNkM6B5rjsU2uQsj1c0bSrbW
> hC9TZZiL1BEWZrhdMAYf36aGKcB8Q095ypfI9xDLgOqibTSXgjQloWg/cpeF4rI6Ht2kTL9ztesR
> IbTA0hKEpZmaXUyYC3rMOgxfeOHGYeUCRAoibigeEBgQ4oRFUCRkGKFSqHEDec/V6/mAvK9BOt/W
> +4++Z3+KmsCgzZqc+klfEdWSTW2pYqDP2wiOkk5XlhnLC8kJ91ZnEh44OJ2ECwMwVlg8KxkKkThx
> YajUvWk6M2Ug7FlM05RzyCo9hQWlwWl445JcQFOgkrtcnMryiA2IsELZatSWw2lrQ0BUlTZnMihV
> G64+aiMOSmyFA7AePDXaNgWF74j4qgIl9lxE/0OQC/xVZ65K0twJlxkQDaUkGoImqA4elCKGMDsO
> I+0mK2VwzFowI2wScDCgQI6CYFI6pKKFcPzbSmtCr2BMoO/P0lQxSTekyuRRNWijvDxr8ggMkdRk
> a0WXHrGqB/cKJbGuogX+5I4C0RHIM6oEOOQGYxGRsw5XTAxZ1HT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