Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)    
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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) 
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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
Esempio n. 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
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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'
Esempio n. 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'
Esempio n. 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'
Esempio n. 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)
Esempio n. 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'
Esempio n. 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)
Esempio n. 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)
    
    
Esempio n. 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)   
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)