def execute(my): my.buffer = cStringIO.StringIO() try: try: # clear the main container for this thread Container.create() # clear the buffer WebContainer.clear_buffer() # initialize the web environment object and register it adapter = my.get_adapter() WebContainer.set_web(adapter) # get the display my._get_display() except SetupException, e: '''Display setup exception in the interface''' print "Setup exception: ", e.__str__() DbContainer.rollback_all() ExceptionLog.log(e) my.writeln("<h3>Tactic Setup Error</h3>" ) my.writeln("<pre>" ) my.writeln(e.__str__() ) my.writeln("</pre>" ) except DatabaseException, e: from tactic.ui.startup import DbConfigPanelWdg config_wdg = DbConfigPanelWdg() my.writeln("<pre>") my.writeln(config_wdg.get_buffer_display()) my.writeln("</pre>")
def execute(my): my.buffer = cStringIO.StringIO() try: # clear the main containers Container.create() # clear the buffer WebContainer.clear_buffer() # initialize the web environment object and register it adapter = my.get_adapter() WebContainer.set_web(adapter) # get the display my._get_display() finally: WebContainer.get_buffer().write(my.buffer.getvalue())
def execute(self): self.buffer = cStringIO.StringIO() error = None try: try: # clear the main container for this thread Container.create() # clear the buffer WebContainer.clear_buffer() # initialize the web environment object and register it adapter = self.get_adapter() WebContainer.set_web(adapter) # get the display self._get_display() except SetupException as e: '''Display setup exception in the interface''' print("Setup exception: ", e.__str__()) DbContainer.rollback_all() ExceptionLog.log(e) self.writeln("<h3>Tactic Setup Error</h3>") self.writeln("<pre>") self.writeln(e.__str__()) self.writeln("</pre>") error = "405: TACTIC Setup Error" except DatabaseException as e: from tactic.ui.startup import DbConfigPanelWdg config_wdg = DbConfigPanelWdg() self.writeln("<pre>") self.writeln(config_wdg.get_buffer_display()) self.writeln("</pre>") error = "405: TACTIC Database Error" except Exception as e: stack_trace = ExceptionLog.get_stack_trace(e) #print(stack_trace) self.writeln("<pre>") self.writeln(stack_trace) self.writeln("</pre>") error = "405 %s" % str(e) # it is possible that the security object was not set security = Environment.get_security() if not security: security = Security() WebContainer.set_security(security) log = None # ensure that database connections are rolled back try: DbContainer.rollback_all() except Exception as e2: print("Error: Could not rollback: ", e2.__str__()) self.writeln("Error: Could not rollback: '%s'" % e2.__str__()) stack_trace = ExceptionLog.get_stack_trace(e2) print(stack_trace) self.writeln("<pre>") self.writeln(stack_trace) self.writeln("</pre>") raise e #return try: # WARNING: if this call causes an exception, the error # will be obscure log = ExceptionLog.log(e) except Exception as e2: print("Error: Could not log exception: ", e2.__str__()) self.writeln("Error '%s': Could not log exception" % e2.__str__()) stack_trace = ExceptionLog.get_stack_trace(e2) print(stack_trace) self.writeln("<pre>") self.writeln(stack_trace) self.writeln("</pre>") return self.writeln("<pre>") self.writeln( "An Error has occurred. Please see your Tactic Administrator<br/>" ) self.writeln("Error Message: %s" % log.get_value("message")) self.writeln("Error Id: %s" % log.get_id()) #self.writeln( log.get_value("stack_trace") ) self.writeln("</pre>") finally: # ensure that database connections are always closed DbContainer.close_all() # clear the container Container.delete() WebContainer.get_buffer().write(self.buffer.getvalue()) if error: import cherrypy print("error: ", error) cherrypy.response.status = error
def execute(self): self.buffer = cStringIO.StringIO() error = None try: try: # clear the main container for this thread Container.create() # clear the buffer WebContainer.clear_buffer() # initialize the web environment object and register it adapter = self.get_adapter() WebContainer.set_web(adapter) # get the display self._get_display() except SetupException as e: '''Display setup exception in the interface''' print("Setup exception: ", e.__str__()) DbContainer.rollback_all() ExceptionLog.log(e) self.writeln("<h3>Tactic Setup Error</h3>" ) self.writeln("<pre>" ) self.writeln(e.__str__() ) self.writeln("</pre>" ) error = "405: TACTIC Setup Error" except DatabaseException as e: from tactic.ui.startup import DbConfigPanelWdg config_wdg = DbConfigPanelWdg() self.writeln("<pre>") self.writeln(config_wdg.get_buffer_display()) self.writeln("</pre>") error = "405: TACTIC Database Error" except Exception as e: stack_trace = ExceptionLog.get_stack_trace(e) #print(stack_trace) self.writeln("<pre>") self.writeln(stack_trace) self.writeln("</pre>") error = "405 %s" % str(e) # it is possible that the security object was not set security = Environment.get_security() if not security: security = Security() WebContainer.set_security(security) log = None # ensure that database connections are rolled back try: DbContainer.rollback_all() except Exception as e2: print("Error: Could not rollback: ", e2.__str__()) self.writeln("Error: Could not rollback: '%s'" % e2.__str__() ) stack_trace = ExceptionLog.get_stack_trace(e2) print(stack_trace) self.writeln("<pre>") self.writeln(stack_trace) self.writeln("</pre>") raise e #return try: # WARNING: if this call causes an exception, the error # will be obscure log = ExceptionLog.log(e) except Exception as e2: print("Error: Could not log exception: ", e2.__str__()) self.writeln("Error '%s': Could not log exception" % e2.__str__() ) stack_trace = ExceptionLog.get_stack_trace(e2) print(stack_trace) self.writeln("<pre>") self.writeln(stack_trace) self.writeln("</pre>") return self.writeln("<pre>") self.writeln("An Error has occurred. Please see your Tactic Administrator<br/>") self.writeln( "Error Message: %s" % log.get_value("message") ) self.writeln("Error Id: %s" % log.get_id() ) #self.writeln( log.get_value("stack_trace") ) self.writeln("</pre>") finally: # ensure that database connections are always closed DbContainer.close_all() # clear the container Container.delete() WebContainer.get_buffer().write( self.buffer.getvalue() ) if error: import cherrypy print("error: ", error) cherrypy.response.status = error