[strongwind] Fix a small typo, python nitpicks



commit 89ebe29d60d9697c3660233ae701a6bab9185e5e
Author: Brad Taylor <brad getcoded net>
Date:   Tue Sep 8 15:12:04 2009 -0400

    Fix a small typo, python nitpicks

 ChangeLog            |    5 +++++
 strongwind/events.py |   10 +++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 78d8f18..017d603 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-09-08  Brad Taylor  <brad getcoded net>
 
+	* strongwind/events.py: Use the more correct way of discovering a
+	variable's type, fix a small bug, and use a bit better in syntax.
+
+2009-09-08  Brad Taylor  <brad getcoded net>
+
 	* strongwind/events.py: Add event listening support.
 
 2009-06-17  Brad Taylor  <brad getcoded net>
diff --git a/strongwind/events.py b/strongwind/events.py
index 980c745..2936137 100644
--- a/strongwind/events.py
+++ b/strongwind/events.py
@@ -99,7 +99,7 @@ class EventListener(threading.Thread):
 
         @param targets: the accessibles to listen to
         '''
-        if type(targets) != type(list()):
+        if not isinstance(targets, list):
             targets = (targets,)
 
         with self.cond:
@@ -158,7 +158,7 @@ class EventListener(threading.Thread):
         @rtype: boolean
         '''
         num = self._getNumEvents(self._unwrapAccessible(target), type)
-        if qty == None:
+        if qty is None:
             return num > 0
         return qty == num
 
@@ -196,7 +196,7 @@ class EventListener(threading.Thread):
         '''
         with self.cond:
             if target:
-                if not target in self.events:
+                if target not in self.events:
                     return 0
 
                 if type:
@@ -219,7 +219,7 @@ class EventListener(threading.Thread):
                 self.cond.notifyAll()
         return False
 
-    def _unwrapAccessible(acc):
-        if type(acc) == type(accessibles.Accessible()):
+    def _unwrapAccessible(self, acc):
+        if isinstance(acc, accessibles.Accessible):
             return acc._accessible
         return acc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]