Continue converting to underscored names.
This commit is contained in:
parent
4375ac7d8b
commit
e18354ae0e
3 changed files with 15 additions and 13 deletions
|
@ -28,7 +28,7 @@ class BaseHandler(object):
|
|||
match -- Compare a stanza with the handler's matcher.
|
||||
prerun -- Handler execution during stream processing.
|
||||
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):
|
||||
|
@ -42,6 +42,8 @@ class BaseHandler(object):
|
|||
this handler.
|
||||
stream -- The XMLStream instance the handler should monitor.
|
||||
"""
|
||||
self.checkDelete = self.check_delete
|
||||
|
||||
self.name = name
|
||||
self.stream = stream
|
||||
self._destroy = False
|
||||
|
@ -79,7 +81,7 @@ class BaseHandler(object):
|
|||
"""
|
||||
self._payload = payload
|
||||
|
||||
def checkDelete(self):
|
||||
def check_delete(self):
|
||||
"""
|
||||
Check if the handler should be removed from the list of stream
|
||||
handlers.
|
||||
|
|
|
@ -25,7 +25,7 @@ class Waiter(BaseHandler):
|
|||
waiter has timed out.
|
||||
|
||||
Methods:
|
||||
checkDelete -- Overrides BaseHandler.checkDelete
|
||||
check_delete -- Overrides BaseHandler.check_delete
|
||||
prerun -- Overrides BaseHandler.prerun
|
||||
run -- Overrides BaseHandler.run
|
||||
wait -- Wait for a stanza to arrive and return it to
|
||||
|
@ -89,10 +89,10 @@ class Waiter(BaseHandler):
|
|||
self.stream.removeHandler(self.name)
|
||||
return stanza
|
||||
|
||||
def checkDelete(self):
|
||||
def check_delete(self):
|
||||
"""
|
||||
Always remove waiters after use.
|
||||
|
||||
Overrides BaseHandler.checkDelete
|
||||
Overrides BaseHandler.check_delete
|
||||
"""
|
||||
return True
|
||||
|
|
|
@ -755,7 +755,7 @@ class XMLStream(object):
|
|||
handler.prerun(stanza_copy)
|
||||
self.event_queue.put(('stanza', handler, stanza_copy))
|
||||
try:
|
||||
if handler.checkDelete():
|
||||
if handler.check_delete():
|
||||
self.__handlers.pop(self.__handlers.index(handler))
|
||||
except:
|
||||
pass # not thread safe
|
||||
|
|
Loading…
Reference in a new issue