In the below when applying the decorator i get an error as TypeError: rt() takes exactly 2 arguments (1 given)
,how to get over this. the same goes with function decorator also ,hIs it because of the parent class.How to resolve this.
class applyfilter(object):
def __init__(self,f):
self.f=f
def __call__(self,*args):
self.f(*args)
or
def applyfilter(f):
def rt1(*args):
print f.__name__
print args
return f(*args)
return rt1
class T1(SuperClass):
@applyfilter
def rt(self,data):
print "In function rt"
t=T1()
t.rt(123)
TypeError: rt() takes exactly 2 arguments (1 given)