79264393

Date: 2024-12-09 09:14:24
Score: 0.5
Natty:
Report link

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

Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: ShaileshKumarMPatel