Blob Blame History Raw
diff -up system-config-printer-1.1.16/asyncpk0.py.asyncpk0-fallback system-config-printer-1.1.16/asyncpk0.py
--- system-config-printer-1.1.16/asyncpk0.py.asyncpk0-fallback	2009-12-22 14:44:19.000000000 +0000
+++ system-config-printer-1.1.16/asyncpk0.py	2010-01-22 11:11:15.604057182 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-## Copyright (C) 2007, 2008, 2009 Red Hat, Inc.
+## Copyright (C) 2007, 2008, 2009, 2010 Red Hat, Inc.
 ## Copyright (C) 2008 Novell, Inc.
 ## Authors: Tim Waugh <twaugh@redhat.com>, Vincent Untz
 
@@ -122,18 +122,24 @@ class PK0Connection(asyncpk1.PK1Connecti
     def _call_with_pk (self, use_pycups, pk_method_name, pk_args,
                        reply_handler, error_handler, unpack_fn,
                        fallback_fn, args, kwds):
-        asyncmethodcall = _PK0AsyncMethodCall (self._system_bus, self,
-                                               pk_method_name, pk_args,
-                                               reply_handler, error_handler,
-                                               unpack_fn, fallback_fn,
-                                               args, kwds, self._parent)
+        if not use_pycups:
+            try:
+                asyncmethodcall = _PK0AsyncMethodCall (self._system_bus, self,
+                                                       pk_method_name, pk_args,
+                                                       reply_handler,
+                                                       error_handler,
+                                                       unpack_fn, fallback_fn,
+                                                       args, kwds,
+                                                       self._parent)
+                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 ()
-
 if __name__ == '__main__':
     import gobject
     import gtk