Example #1
0
def get(req):
    param = json.loads(req.body)
    
    path = path2o(param.get('path'))
    s = FSt(path)
    if not s.exists:
        return Response(status=404)

    app_iter = s.get()
    response = Response(app_iter=app_iter,request=req)
    return req.get_response(response)
Example #2
0
def delete(req):
   
    param = json.loads(req.body)
    path = path2o(param.get('path')) 
    
    s = FSt(path)
    if not s.exists:
        return Response(status=404)
    ecode = s.delete()
    
    return Response(status=ecode) 
Example #3
0
def post(req):
    
    param = json.loads(req.body)
    path = path2o(param.get('path'))
    
    s = FSt(path)
    if not s.exists:
        return Response(status = 404)
    attrs = req.headers
    ecode = s.setm(attrs)    
    return Response(status=ecode)
Example #4
0
def put():
    req = request
    param = req.headers
    path = path2o(param.get('path'))
    s = FSt(path)
    
    md5 = req.headers.get('md5')
    datatype = req.headers.get('datatype') 
    fileinput = req.environ['wsgi.input']
    ecode = s.put(md5,datatype,fileinput,req.content_length)
    
    return Response(status=ecode)
Example #5
0
def copy(req):

    param = json.loads(req.body)
    src = path2o(param.get('src'))
    dst = path2o(param.get('dst'))
    s = FSt(src)
    d = FSt(dst)
    if not s.exists:
        return Response(status=404)

    ecode = s.copy(d)
    return Response(status = ecode)
Example #6
0
def put(req):
    
    param = req.headers
    path = path2o(param.get('path'))
    s = FSt(path)
    
    md5 = req.headers.get('md5')
    datatype = req.headers.get('datatype') 
    fileinput = req.environ['wsgi.input']
    ecode = s.put(md5,datatype,fileinput)
    
    return Response(status=ecode)
Example #7
0
def post():

    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))

    s = FSt(path)
    if not s.exists:
        return Response(status=404)
    attrs = req.headers
    ecode = s.setm(attrs)
    return Response(status=ecode)
Example #8
0
def put():
    req = request
    param = req.headers
    path = path2o(param.get('path'))
    s = FSt(path)

    md5 = req.headers.get('md5')
    datatype = req.headers.get('datatype')
    fileinput = req.environ['wsgi.input']
    ecode = s.put(md5, datatype, fileinput, req.content_length)

    return Response(status=ecode)
Example #9
0
def delete():

    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))

    s = FSt(path)
    if not s.exists:
        return Response(status=404)
    ecode = s.delete()

    return Response(status=ecode)
Example #10
0
def get():
    req = request
    param = json.loads(req.data)
    
    path = path2o(param.get('path'))
    s = FSt(path)
    if not s.exists:
        return Response(status=404)

    app_iter = s.get()
    response = Response(response=app_iter)
#    return req.get_response(response)
    return response
Example #11
0
def copy():

    req = request
    param = json.loads(req.data)
    src = path2o(param.get('src'))
    dst = path2o(param.get('dst'))
    s = FSt(src)
    d = FSt(dst)
    if not s.exists:
        return Response(status=404)

    ecode = s.copy(d)
    return Response(status=ecode)
Example #12
0
def get():
    req = request
    param = json.loads(req.data)

    path = path2o(param.get('path'))
    s = FSt(path)
    if not s.exists:
        return Response(status=404)

    app_iter = s.get()
    response = Response(response=app_iter)
    #    return req.get_response(response)
    return response
Example #13
0
def move():

    req = request
    param = json.loads(req.data)
    src = path2o(param.get('src'))
    dst = path2o(param.get('dst'))
    
    s = FSt(src)
    d = FSt(dst)
    
    if not s.exists:
        return Response(status=404)
        
    ecode = s.move(d)
    return Response(status=ecode)
Example #14
0
def head(req):

    param = json.loads(req.body)
    path = path2o(param.get('path')) 
    is_swift = param.get('is_swift')
    s = FSt(path)
    ecode = 200 
    if not s.exists:
        ecode = 404
        return Response(ecode)
    data = s.getm()
    if 'true' == is_swift:
        return Response(status=ecode,headers=data)
    else:
        return Response(json.dumps(data),status=ecode)
Example #15
0
def head():

    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    is_swift = param.get('is_swift')
    s = FSt(path)
    ecode = 200
    if not s.exists:
        ecode = 404
        return Response(ecode)
    data = s.getm()
    if 'true' == is_swift:
        return Response(status=ecode, headers=data)
    else:
        return Response(response=json.dumps(data), status=ecode)
Example #16
0
def url2st(urlObj):
    return FSt(urlObj.subject)