예제 #1
0
def get_context():
    context = {"working_directory": ".", "detach_process": False}
    if conf("server.daemonize"):
        log_file = open(conf("server.daemon_log"), "w+")
        context.update(detach_process=True, stdout=log_file, stderr=log_file)
    else:
        context.update(files_preserve=[sys.stdout, sys.stderr], stdout=sys.stdout, stderr=sys.stderr)

    return daemon.DaemonContext(**context)
예제 #2
0
파일: server.py 프로젝트: mshuler/repoman
def get_context():
    context = {'working_directory': '.', 'detach_process': False}
    if conf('server.daemonize'):
        log_file = open(conf('server.daemon_log'), 'w+')
        context.update(detach_process=True, stdout=log_file, stderr=log_file)
    else:
        context.update(files_preserve=[sys.stdout, sys.stderr],
                       stdout=sys.stdout,
                       stderr=sys.stderr)

    return daemon.DaemonContext(**context)
예제 #3
0
파일: server.py 프로젝트: chrislea/repoman
def get_context():
    context = {'working_directory': '.',
               'detach_process': False}
    if conf('server.daemonize'):
        log_file = open(conf('server.daemon_log'), 'w+')
        context.update(detach_process=True,
                       stdout=log_file,
                       stderr=log_file)
    else:
        context.update(files_preserve=[sys.stdout, sys.stderr],
                       stdout=sys.stdout,
                       stderr=sys.stderr)

    return daemon.DaemonContext(**context)
예제 #4
0
파일: common.py 프로젝트: mshuler/repoman
 def get(self, path):
     if path.strip('/') == '':
         path = 'index.html'
     root = conf('server.static_path')
     path = os.path.join(root, path)
     if not path.startswith(root):
         return Response(status=400, body='400 Bad Request')
     else:
         return Response(status=200, body=file(path, 'rb').read())
예제 #5
0
 def get(self, path):
     if path.strip('/') == '':
         path = 'index.html'
     root = conf('server.static_path')
     path = os.path.join(root, path)
     if not path.startswith(root):
         return Response(status=400, body='400 Bad Request')
     else:
         return Response(status=200, body=file(path, 'rb').read())