def list( path, permissions = None ): if __check_authentication(path, 'r', permissions): #check permissions to read directory return PALDatastore.list_bucket(path) #call into PAL to list bucket return False #return false on failure
def open( path, mode = 'r', permissions = None): if __check_authentication( path, mode, permissions): if check_exists( path, permissions): return PALDatastore.open( path, mode ) return False
def check_exists ( path, permissions): if __check_authentication ( path, 'r' , permissions ): if PALDatastore.stat( path ) is None : return False else: return True else: return False
def delete( path, permissions = None, allow_dir = False ): if allow_dir: return False else: if __check_authentication(path, 'd'): return PALDatastore.delete(path) return False
def append( path, blob, permissions = None ): if __check_authentication( path, 'a', permissions): if check_exists( path, permissions ): file_handle = PALDatastore.open( path, 'a') file_handle.write(blob) return True else: return False else: return False
def add_file( path, name = None, blob = None, mode = None, permissions = None ): if check_exists( path, permissions ): return False else: file_handle = PALDatastore.open(path,'w') if file_handle is None: return False if blob is not None: file_handle.write(blob) file_handle.close() userobj = users.get_current_user() permis = Permissions(True,True,True) __add_authentication(path, name, userobj, permis) if mode is None: return False else: return PALDatastore.open(path, mode)
def add_directory( path, permissions = None ): if check_exists(path, permissions): return False else: if check_exists(get_container(path),permissions): file_handle = PALDatastore.open(path, 'w') if file_handle is None: return False else: file_handle.close(); return True else: return False
def get_file_info(file_name): return PALDatastore.stat(file_name)