james_027 said:
Hi,
I am going to use this in Django. I am trying to implement a
permission here, where in the database store the methods that the user
are allowed to execute. for example if the method is def
create_event(): the method will look for create_event in the database
to see if it allow to be execute.
This might help, I used it for a similar need I had in the past where I needed a method to know the name it was called with
class TestClass:
def __init__(self):
pass
def __getattr__(self, name):
try:
return getattr(self.__class__, name)
except AttributeError:
return functools.partial(self.foo, name)
def foo(self, name, **args):
print name
for i in args:
print " %s=%s" % (i, args
)