def _cp_on_http_error(status, message): # check if this project exists response = cherrypy.response path = cherrypy.request.path parts = path.split("/") if len(parts) < 3: cherrypy.response.body = '<meta http-equiv="refresh" content="0;url=/tactic" />' return else: project_code = parts[2] from pyasm.security import TacticInit TacticInit() import sys, traceback tb = sys.exc_info()[2] stacktrace = traceback.format_tb(tb) stacktrace_str = "".join(stacktrace) print "-" * 50 print stacktrace_str print "-" * 50 print path, status, message try: eval("cherrypy.root.tactic.%s" % project_code) # if project_code is empty , it raises SyntaxError except (AttributeError, SyntaxError), e: has_project = False
def error_page(my, status, message, traceback, version): # check if this project exists response = cherrypy.response request = cherrypy.request path = request.path_info parts = path.split("/") if len(parts) < 3: cherrypy.response.body = '<meta http-equiv="refresh" content="0;url=/tactic" />' return else: project_code = parts[2] from pyasm.security import TacticInit TacticInit() #import sys,traceback #tb = sys.exc_info()[2] #stacktrace = traceback.format_tb(tb) #stacktrace_str = "".join(stacktrace) #print "-"*50 #print stacktrace_str #print "-"*50 # Dump out the error print "WARNING: ", path, status, message try: eval("cherrypy.root.tactic.%s" % project_code) # if project_code is empty , it raises SyntaxError except (AttributeError, SyntaxError), e: has_project = False
def error_page(my, status, message, traceback, version): # check if this project exists response = cherrypy.response request = cherrypy.request path = request.path_info parts = path.split("/") if len(parts) < 3: cherrypy.response.body = '<meta http-equiv="refresh" content="0;url=/tactic" />' return from pyasm.security import Site site_obj = Site.get() path_info = site_obj.break_up_request_path(path) if path_info: site = path_info['site'] project_code = path_info['project_code'] else: project_code = parts[2] site = "" # sites is already mapped in config for cherrypy if site == "plugins": return print "WARNING:" print " status: ", status print " message: ", message print " site: ", site print " project_code: ", project_code # Dump out the error has_site = False try: from pyasm.security import TacticInit TacticInit() Site.set_site(site) if site: eval("cherrypy.root.tactic.%s.%s" % (site, project_code)) else: eval("cherrypy.root.tactic.%s" % project_code) # if project_code is empty , it raises SyntaxError except (AttributeError, SyntaxError), e: print "WARNING: ", e has_project = False has_site = True