pvl/syslog/syslog.py
changeset 115 9772d43669fb
parent 112 8127c0f4223d
child 139 515b74c6b456
--- a/pvl/syslog/syslog.py	Sun Jan 13 01:50:25 2013 +0200
+++ b/pvl/syslog/syslog.py	Sun Jan 13 01:52:00 2013 +0200
@@ -1,5 +1,7 @@
 """
     Syslog handling.
+
+    XXX: this belongs in pvl.syslog.source (apart from __iter__?)
 """
 
 import select
@@ -19,14 +21,14 @@
             Using given underlying line source.
                 
                 source      - source to select() if poll=True
-                poll        - polling behaviour
+                poll        - polling behaviour for source
         """
         
         self.source = source
         self.parser = parser
         self.filter = filter
 
-        self._poll = poll
+        self.poll = poll
 
     def __iter__ (self) :
         """
@@ -38,7 +40,7 @@
     def fileno (self) :
         return self.source.fileno()
 
-    def poll (self, poll=None, reading=(), writing=()) :
+    def select (self, poll=None, reading=(), writing=()) :
         """
             Poll our source for input, with given polling behaviour:
                 True    - select() on source
@@ -48,10 +50,6 @@
             Returns None on unknown, empty sequence on timeout, list of readables on select.
         """
         
-        # from __init__
-        if poll is None :
-            poll = self._poll
-
         if poll is True :
             timeout = None # block
             reading += (self, ) # source.fileno()
@@ -91,6 +89,11 @@
             TODO: SIGINT -> finish iteration and return?
         """
 
+        # from __init__
+        # note that we must interpret poll here, since False -> never poll
+        if poll is None :
+            poll = self.poll
+
         # mainloop
         while True :
             # pull in messages
@@ -101,7 +104,8 @@
             # poll
             if poll :
                 # wait
-                self.poll(poll)
+                self.select(poll)
+
             else :
                 # done
                 break