Beispiel #1
0
def move(req):
    
    param = json.loads(req.body)
    src = path2o(param.get('src'))
    dst = path2o(param.get('dst'))
    s = DSt(src)
    d = DSt(dst)
    ecode = s.move(d)
    return Response(status = ecode)
Beispiel #2
0
def http_dir_move():

    req = request
    param = json.loads(req.data)
    src = path2o(param.get('src'))
    dst = path2o(param.get('dst'))
    s = DSt(src)
    d = DSt(dst)
    ecode = s.move(d)
    return Response(status=ecode)
Beispiel #3
0
def http_dir_move():
    
    req = request
    param = json.loads(req.data)
    src = path2o(param.get('src'))
    dst = path2o(param.get('dst'))
    s = DSt(src)
    d = DSt(dst)
    ecode = s.move(d)
    return Response(status = ecode)
Beispiel #4
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)
Beispiel #5
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)
Beispiel #6
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)
Beispiel #7
0
def get(req):

    param = json.loads(req.body)
    path = path2o(param.get('path'))
    a = ASt(path)
    if not a.exists:
        return Response(status=404)
    attrs = a.list()
    attrs = [{'a':'b'},{'c':'d'}] 
    return Response(body=json.dumps(attrs),status=200)
Beispiel #8
0
def put(req):
    
    param = json.loads(req.body)
    path = path2o(param.get('path'))
    a = ASt(path)
    if a.exists:
        return Response(status=409)
    
    ecode = a.put()
    return Response(status=ecode)    
Beispiel #9
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)
Beispiel #10
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)
Beispiel #11
0
def http_dir_put():

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

    if d.exists:
        return Response(status=409)
    ecode = d.put()
    return Response(status=ecode)
Beispiel #12
0
def delete(req):
    
    param = json.loads(req.body)
    path = path2o(param.get('path'))
    
    c = CSt(path)
    if not c.exists:
        return Response(status=404)
    
    ecode = c.delete()
    return Response(status=ecode)
Beispiel #13
0
def http_dir_put():
    
    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    d = DSt(path)
    
    if d.exists:
        return Response(status=409)
    ecode = d.put()
    return Response(status=ecode)
Beispiel #14
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)
Beispiel #15
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)
Beispiel #16
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)
Beispiel #17
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)
Beispiel #18
0
def post(req):
    
    param = json.loads(req.body)
    path = path2o(param.get('path'))
    a = ASt(path)
    if not a.exists:
        return Response(status=404)
    
    headers = req.headers
    attrs = headers
    ecode = a.putm(attrs)
    return Response(status=ecode)
Beispiel #19
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) 
Beispiel #20
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)
Beispiel #21
0
def http_container_delete():
    
    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    
    c = CSt(path)
    if not c.exists:
        return Response(status=404)
    
    ecode = c.delete()
    return Response(status=ecode)
Beispiel #22
0
def http_account_post():
    
    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    a = ASt(path)
    if not a.exists:
        return Response(status=404)
    
    headers = req.headers
    attrs = headers
    ecode = a.putm(attrs)
    return Response(status=ecode)
Beispiel #23
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
Beispiel #24
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
Beispiel #25
0
def delete(req):
    
    param = json.loads(req.body)
    path = path2o(param.get('path'))
    tree = param.get('tree')
    if 'true' == tree:
        r = True
    else:
        r = False
         
    d = DSt(path)
    ecode = d.delete(r)
    return Response(status = ecode)
Beispiel #26
0
def http_account_post():

    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    a = ASt(path)
    if not a.exists:
        return Response(status=404)

    headers = req.headers
    attrs = headers
    ecode = a.putm(attrs)
    return Response(status=ecode)
Beispiel #27
0
def http_dir_delete():
    
    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    tree = param.get('tree')
    if 'true' == tree:
        r = True
    else:
        r = False
         
    d = DSt(path)
    ecode = d.delete(r)
    return Response(status = ecode)
Beispiel #28
0
def http_dir_delete():

    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    tree = param.get('tree')
    if 'true' == tree:
        r = True
    else:
        r = False

    d = DSt(path)
    ecode = d.delete(r)
    return Response(status=ecode)
Beispiel #29
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)
Beispiel #30
0
def head(req):

    param = json.loads(req.body)
    path = path2o(param.get('path'))
    is_swift = param.get('is_swift')

    a = ASt(path)
    if not a.exists:
        return Response(status=404)
    
    attrs = a.getm()
    if 'true' == is_swift:
        return Response(status=200,headers=attrs)
    else:
        return Response(body=json.dumps(attrs),status=200)
Beispiel #31
0
def http_account_get():
    try:
        uid = os.getuid()
        user = getpass.getuser()
        req = request
        param = json.loads(req.data)
        path = path2o(param.get('path'))
        a = ASt(path)
        if not a.exists:
            return Response(response=a.path, status=404)
        attrs = a.list()
        return Response(response=json.dumps(attrs), status=200)
    except:
        msg = str(user + str(uid) + traceback.format_exc())
        syslog.syslog(syslog.LOG_ERR, msg)
        return 'account exception'
Beispiel #32
0
def http_account_put():

    try:
        req = request
        param = json.loads(req.data)
        path = path2o(param.get('path'))
        a = ASt(path)
        if a.exists:
            return Response(status=409)

        ecode = a.put()
        return Response(status=ecode)
    except:
        msg = getpass.getuser() + str(traceback.format_exc())
        syslog.syslog(syslog.LOG_ERR, msg)
        return 'account exception'
Beispiel #33
0
def http_account_get():
    try:
        uid = os.getuid()
        user = getpass.getuser()
        req = request
        param = json.loads(req.data)
        path = path2o(param.get('path'))
        a = ASt(path)
        if not a.exists:
            return Response(response=a.path,status=404)
        attrs = a.list()
        return Response(response=json.dumps(attrs),status=200)
    except:
        msg = str(user+str(uid)+traceback.format_exc())
        syslog.syslog(syslog.LOG_ERR,msg)
        return 'account exception'
Beispiel #34
0
def get(req):
    
    param = json.loads(req.body)
    path = path2o(param.get('path'))
    tree = param.get('tree')
    if 'true' == tree:
        r = True
    else:
        r = False
        
    c = CSt(path)
    if not c.exists:
        return Response(status=404)

    attrs = c.list(r)
    return Response(body = json.dumps(attrs),status=200)
Beispiel #35
0
def http_account_put():
   
    try: 
        req = request
        param = json.loads(req.data)
        path = path2o(param.get('path'))
        a = ASt(path)
        if a.exists:
            return Response(status=409)
    
        ecode = a.put()
        return Response(status=ecode)    
    except:
        msg = getpass.getuser()+str(traceback.format_exc())
        syslog.syslog(syslog.LOG_ERR,msg)
        return 'account exception'
Beispiel #36
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)
Beispiel #37
0
def http_container_post():
    
    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    
    c = CSt(path)
    if not c.exists:
        return Response(status=404)
    
    headers = req.headers
    attrs = headers
    ecode = c.putm(attrs)
    return Response(status = ecode)
    
    
Beispiel #38
0
def http_container_head():
    
    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    is_swift = param.get('is_swift')
 
    c = CSt(path)
    if not c.exists:
        return Response(status=404)
    
    attrs = c.getm()
    if 'true' == is_swift:
        return Response(status=200,headers=attrs)
    else:
        return Response(response = json.dumps(attrs),status=200)   
Beispiel #39
0
def get(req):

    param = json.loads(req.body)
    path = path2o(param.get('path'))
    tree = param.get('tree')
    if 'true' == tree:
        r = True
    else:
        r = False
        
    d = DSt(path)    
    if not d.exists:
        return Response(status=404)
    if not os.path.isdir(d.path):
        return Response(body = 'path type error',status=400)
    attrs = d.list(r)
    return Response(body = json.dumps(attrs),status=200)
Beispiel #40
0
def http_container_get():
    
    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    tree = param.get('tree')
    if 'true' == tree:
        r = True
    else:
        r = False
        
    c = CSt(path)
    if not c.exists:
        return Response(status=404)

    attrs = c.list(r)
    return Response(response = json.dumps(attrs),status=200)
Beispiel #41
0
def http_dir_get():

    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    tree = param.get('tree')
    if 'true' == tree:
        r = True
    else:
        r = False

    d = DSt(path)
    if not d.exists:
        return Response(status=404)
    if not os.path.isdir(d.path):
        return Response(response='path type error', status=400)
    attrs = d.list(r)
    return Response(response=json.dumps(attrs), status=200)
Beispiel #42
0
def http_dir_get():

    req = request
    param = json.loads(req.data)
    path = path2o(param.get('path'))
    tree = param.get('tree')
    if 'true' == tree:
        r = True
    else:
        r = False
        
    d = DSt(path)    
    if not d.exists:
        return Response(status=404)
    if not os.path.isdir(d.path):
        return Response(response = 'path type error',status=400)
    attrs = d.list(r)
    return Response(response = json.dumps(attrs),status=200)