[pyatspi2] Use hasatrr instead of handling the exception of a	non-iterable object
- From: Javier HernÃndez AntÃnez <jhernandez src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [pyatspi2] Use hasatrr instead of handling the exception of a	non-iterable object
 
- Date: Mon, 10 Oct 2011 16:08:31 +0000 (UTC)
 
commit 6bfe1cd5b3af2d9fee6a7dbde3b0d6f6b93ea9dc
Author: Javier HernÃndez <jhernandez emergya es>
Date:   Mon Oct 10 11:15:50 2011 +0200
    Use hasatrr instead of handling the exception of a non-iterable object
 pyatspi/registry.py |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/pyatspi/registry.py b/pyatspi/registry.py
index fb3ba1e..7ea25b7 100644
--- a/pyatspi/registry.py
+++ b/pyatspi/registry.py
@@ -312,10 +312,9 @@ class Registry(object):
                 except:
                         listener = self.event_listeners[client] = Atspi.DeviceListener.new(self.eventWrapper, client)
                 syncFlag = self.makeSyncType(synchronous, preemptive, global_)
-                try:
-                        iter(mask)
+                if hasattr(mask, '__iter__'):
                         masks = mask
-                except:
+                else:
                         masks = [mask]
                 for m in masks:
                         Atspi.register_keystroke_listener(listener,
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]