Here is corrected decorator
def decorate_verify_user(fun):
def nothing():
logging.debug("no username password available")
return template("failed_login.html",post_data="No post_data")
@wraps(fun)
def do_it():
if(verify_user()==True):
logging.debug("#fun() reached...")
return fun() #return added XXX
else:
return nothing() #return added YYY
logging.debug("function name of do_it is {}".format(do_it.__name__))
return do_it
Only return was added to fun() and nothing() at XXX and YYY As I understand, I needed to return template for display in browser. In earlier code, function was executed but template was returned, hence, no display of template in browser