Ejemplo n.º 1
0
    def post(self):
        recording.dont_record()
        if not self._check_access():
            return

        recorder = recording.Recorder(os.environ)
        recording.recorder_proxy.set_for_current_request(recorder)

        script = self.request.get('script', '').replace('\r\n', '\n')
        output, errors = self.execute_script(script)

        recording.recorder_proxy.clear_for_current_request()
        recorder.record_http_status(0)
        recorder.save()
        record = recorder.get_full_proto()

        extra_data = {
            'is_shell': True,
            'script': script,
            'output': output,
            'errors': errors,
            'time_key': int(recorder.start_timestamp * 1000),
            'xsrf_token': admin.get_xsrf_token(),
        }
        render_record(self.response, record, './file', extra_data)
    def testXsrfToken(self):
        class MockRequest(object):
            def __init__(self):
                self.host = 'localhost:8080'

        handler = XsrfTokenHandler()
        handler.request = MockRequest()
        result = handler.render()
        self.assertEqual(result, admin.get_xsrf_token())
Ejemplo n.º 3
0
 def get(self):
   recording.dont_record()
   if not self._check_access():
     return
   script = self.request.get('script', recording.config.DEFAULT_SCRIPT)
   extra_data = {'is_shell': True,
                 'script': script,
                 'xsrf_token': admin.get_xsrf_token(),
                 }
   render_record(self.response, None, './file', extra_data)
Ejemplo n.º 4
0
 def get(self):
   recording.dont_record()
   if not self._check_access():
     return
   script = self.request.get('script', recording.config.DEFAULT_SCRIPT)
   extra_data = {'is_shell': True,
                 'script': script,
                 'xsrf_token': admin.get_xsrf_token(),
                 }
   render_record(self.response, None, './file', extra_data)
Ejemplo n.º 5
0
  def post(self):
    recording.dont_record()
    if not self._check_access():
      return

    recorder = recording.Recorder(os.environ)
    recording.recorder_proxy.set_for_current_request(recorder)

    script = self.request.get('script', '').replace('\r\n', '\n')
    output, errors = self.execute_script(script)

    recording.recorder_proxy.clear_for_current_request()
    recorder.record_http_status(0)
    recorder.save()
    record = recorder.get_full_proto()

    extra_data = {'is_shell': True,
                  'script': script,
                  'output': output,
                  'errors': errors,
                  'time_key': int(recorder.start_timestamp * 1000),
                  'xsrf_token': admin.get_xsrf_token(),
                  }
    render_record(self.response, record, './file', extra_data)
 def render(self):
     if not self.request.host.startswith('localhost:'):
         return 'access from %s' % self.request.host
     from google.appengine.ext import admin
     return admin.get_xsrf_token()