def new_root_item(cls, ref_id, pan_id): data_item = ClientDataItem(category=6, isdir=1, filename=TOP_DIR_FILE_NAME, fs_id='0', path='/', size=0, md5_val='', ref_id=ref_id, parent=0, panacc=pan_id, source_fs_id=TOP_DIR_FILE_NAME) with db: data_item.save(force_insert=True) return data_item
def new_top_dir_item(cls, ref_id, pan_id, fs_id, server_ctime, top_dir_name): data_item = ClientDataItem(category=6, isdir=1, filename=top_dir_name, fs_id=fs_id, path='/%s' % top_dir_name, size=0, md5_val='', ref_id=ref_id, parent=0, panacc=pan_id, server_ctime=server_ctime, source_fs_id=top_dir_name) with db: data_item.save(force_insert=True) return data_item
def new_data_item(cls, params): """ :param params: :return: """ data_item = ClientDataItem(category=params['category'], isdir=params['isdir'], filename=params['filename'], aliasname=params['aliasname'], fs_id=params['fs_id'], path=params['path'], size=params['size'], md5_val=params.get('md5_val', ''), ref_id=params.get('ref_id'), source_fs_id=params.get('source_fs_id'), pin=params.get('pin'), parent=params.get('parent', 0), panacc=params.get('panacc', 0)) with db: data_item.save(force_insert=True) return data_item