system-config-printer/system-config-printer-async-fallback.patch

37 lines
1.8 KiB
Diff

diff -up system-config-printer-1.1.16/asyncpk1.py.async-fallback system-config-printer-1.1.16/asyncpk1.py
--- system-config-printer-1.1.16/asyncpk1.py.async-fallback 2009-12-22 14:27:37.000000000 +0000
+++ system-config-printer-1.1.16/asyncpk1.py 2010-01-18 16:53:36.820434799 +0000
@@ -288,18 +288,24 @@ class PK1Connection:
def _call_with_pk (self, use_pycups, pk_method_name, pk_args,
reply_handler, error_handler, unpack_fn,
fallback_fn, args, kwds):
- asyncmethodcall = _PK1AsyncMethodCall (self._system_bus, self,
- pk_method_name, pk_args,
- reply_handler, error_handler,
- unpack_fn, fallback_fn,
- args, kwds)
+ if not use_pycups:
+ try:
+ asyncmethodcall = _PK1AsyncMethodCall (self._system_bus, self,
+ pk_method_name, pk_args,
+ reply_handler,
+ error_handler,
+ unpack_fn, fallback_fn,
+ args, kwds)
+
+ debugprint ("Calling PK method %s" % pk_method_name)
+ asyncmethodcall.call ()
+ except dbus.DBusException, e:
+ debugprint ("D-Bus call failed: %s" % repr (e))
+ use_pycups = True
if use_pycups:
return asyncmethodcall.call_fallback_fn ()
- debugprint ("Calling PK method %s" % pk_method_name)
- asyncmethodcall.call ()
-
def _nothing_to_unpack (self):
return None