21 lines
490 B
Python
21 lines
490 B
Python
|
|
class WebCallable:
|
|
|
|
def __init__(self, method=None, instance=None):
|
|
self._method = method
|
|
self._instance = instance
|
|
|
|
def __call__(self,request, o=None):
|
|
if (hasattr(self,"_method")):
|
|
m = getattr( self, "_method")
|
|
i = getattr( self, "_instance", o)
|
|
if i is None:
|
|
i = o
|
|
m(i,request, o=o)
|
|
else:
|
|
request.getContentFile().write("<html><head><title>No Content</title></head><body>Sorry, no content here!</body></html>")
|
|
|
|
class WebCallableObject(WebCallable):
|
|
pass
|
|
|