Example #1
0
 def log(self, sid):
     # len = request.headers['content-length']
     new_file_path = os.path.join(get_runtime_folder(), sid)
     with open(new_file_path, 'wb') as f:
         data = request.stream.read()
         f.write(b'<pre>')
         f.write(data)
         f.write(b'</pre>')
         f.close()
     return jsonify(status='ok'), 200
Example #2
0
    def view_log_service(self):
        path = os.path.join(get_runtime_folder(), service.id)
        try:
            with open(path, "r") as f:
                content = f.read()

            return content
        except OSError as e:
            print('Caught exception OSError : {0}'.format(e))
            return '''<pre>Not found, please use get log button firstly.</pre>'''
Example #3
0
    def view_log(self):
        server = current_user.get_current_server()
        if server:
            path = os.path.join(get_runtime_folder(), str(server.id))
            try:
                with open(path, "r") as f:
                    content = f.read()

                return content
            except OSError as e:
                print('Caught exception OSError : {0}'.format(e))
                return '''<pre>Not found, please use get log button firstly.</pre>'''
        return '''<pre>Not found, please create server firstly.</pre>'''