2018-12-06 Fred Gleason <fredg@paravelsystems.com>

* Removed support for the 'priv' argument in callbacks in PyPAD
	scripts.
This commit is contained in:
Fred Gleason 2018-12-06 15:54:19 -05:00
parent c80f67cfd0
commit 340f834839
3 changed files with 7 additions and 18 deletions

View File

@ -18104,3 +18104,6 @@
* Added a set of Python classes for processing PAD updates.
2018-12-06 Fred Gleason <fredg@paravelsystems.com>
* Added comments to the 'now_and_next.py' PyPAD script.
2018-12-06 Fred Gleason <fredg@paravelsystems.com>
* Removed support for the 'priv' argument in callbacks in PyPAD
scripts.

View File

@ -152,10 +152,9 @@ class PyPADUpdate(object):
class PyPADReceiver(object):
def __init__(self):
self.__callback=None
self.__priv=None
def __PyPAD_Process(self,pad):
self.__callback(pad,self.__priv)
self.__callback(pad)
def setCallback(self,cb):
"""
@ -163,13 +162,6 @@ class PyPADReceiver(object):
"""
self.__callback=cb
def setPrivateObject(self,obj):
"""
Set the 'private' object. This object will be passed to the
callback in its second argument.
"""
self.priv=obj
def start(self,hostname):
"""
Connect to a Rivendell system and begin processing PAD events.

View File

@ -31,16 +31,10 @@ import rivendell.PyPAD
#
# First, we create a callback method, that will be called every time a
# log machine updates its PAD. Two arguments are supplied:
# log machine updates its PAD. An instance of 'PyPADUpdate' that contains
# the PAD information is supplied as the single argument.
#
# update - An instance of 'PyPADUpdate' that contains the PAD information.
#
# priv - An arbitrary object that was passed to 'PyPADReceiver' using
# its 'setPrivateObject()' method. This allows initialiation to
# be done (create sockets, file handles, etc) before starting the
# receiver and then passing those objects to the processing callback.
#
def ProcessPad(update,priv):
def ProcessPad(update):
print
if update.hasNowPad():
print "Log %03d NOW: " % update.logMachine()+update.padFields("%a - %t")