Beispiel #1
0
 def post(self):
     """
     POST handler invoked by AJAX call.
     """
     shell_input = self.request.get('input')
     if not shell_input:
         self.respond_with("")
         return
     worker_id = self.request.get('id')
     if not worker_id:
         self.respond_with("")
         return
     
     shell_worker = ShellWorker(id = worker_id)
     shell_worker.post_message(shell_input)
     
     result, has_result = self.__try_to_obtain_result()
     result = result if has_result else "<Failed to evaluate input>"
     
     resp = { 'input': input, 'result': result }   
     self.respond_with(json.dumps(resp))
Beispiel #2
0
 def get(self):
     worker = ShellWorker()
     worker.start()
     self.render(worker_id = worker._id)