Continue converting to underscored names.

This commit is contained in:
Lance Stout 2010-10-18 09:06:54 -04:00
parent 4375ac7d8b
commit e18354ae0e
3 changed files with 15 additions and 13 deletions

View file

@ -28,7 +28,7 @@ class BaseHandler(object):
match -- Compare a stanza with the handler's matcher. match -- Compare a stanza with the handler's matcher.
prerun -- Handler execution during stream processing. prerun -- Handler execution during stream processing.
run -- Handler execution during the main event loop. run -- Handler execution during the main event loop.
checkDelete -- Indicate if the handler may be removed from use. check_delete -- Indicate if the handler may be removed from use.
""" """
def __init__(self, name, matcher, stream=None): def __init__(self, name, matcher, stream=None):
@ -42,6 +42,8 @@ class BaseHandler(object):
this handler. this handler.
stream -- The XMLStream instance the handler should monitor. stream -- The XMLStream instance the handler should monitor.
""" """
self.checkDelete = self.check_delete
self.name = name self.name = name
self.stream = stream self.stream = stream
self._destroy = False self._destroy = False
@ -79,7 +81,7 @@ class BaseHandler(object):
""" """
self._payload = payload self._payload = payload
def checkDelete(self): def check_delete(self):
""" """
Check if the handler should be removed from the list of stream Check if the handler should be removed from the list of stream
handlers. handlers.

View file

@ -25,7 +25,7 @@ class Waiter(BaseHandler):
waiter has timed out. waiter has timed out.
Methods: Methods:
checkDelete -- Overrides BaseHandler.checkDelete check_delete -- Overrides BaseHandler.check_delete
prerun -- Overrides BaseHandler.prerun prerun -- Overrides BaseHandler.prerun
run -- Overrides BaseHandler.run run -- Overrides BaseHandler.run
wait -- Wait for a stanza to arrive and return it to wait -- Wait for a stanza to arrive and return it to
@ -89,10 +89,10 @@ class Waiter(BaseHandler):
self.stream.removeHandler(self.name) self.stream.removeHandler(self.name)
return stanza return stanza
def checkDelete(self): def check_delete(self):
""" """
Always remove waiters after use. Always remove waiters after use.
Overrides BaseHandler.checkDelete Overrides BaseHandler.check_delete
""" """
return True return True

View file

@ -755,7 +755,7 @@ class XMLStream(object):
handler.prerun(stanza_copy) handler.prerun(stanza_copy)
self.event_queue.put(('stanza', handler, stanza_copy)) self.event_queue.put(('stanza', handler, stanza_copy))
try: try:
if handler.checkDelete(): if handler.check_delete():
self.__handlers.pop(self.__handlers.index(handler)) self.__handlers.pop(self.__handlers.index(handler))
except: except:
pass # not thread safe pass # not thread safe