Пример #1
0
 def new_root_item(cls, user_id, pan_id):
     data_item = DataItem(category=6,
                          isdir=1,
                          filename=TOP_DIR_FILE_NAME,
                          fs_id='0',
                          path='/',
                          size=0,
                          md5_val='',
                          account_id=user_id,
                          parent=0,
                          panacc=pan_id)
     with db:
         data_item.save(force_insert=True)
         return data_item.id, data_item
Пример #2
0
 def save_data_item(cls, is_dir, params):
     data_item = DataItem(category=params['category'],
                          isdir=is_dir,
                          filename=params['filename'],
                          fs_id=params['fs_id'],
                          path=params['path'],
                          size=params['size'],
                          md5_val=params.get('md5_val', ''),
                          account_id=params.get('account_id'),
                          parent=params.get('parent', 0),
                          panacc=params.get('panacc', 0))
     with db:
         data_item.save(force_insert=True)
     cls.sync_data_item_to_es(data_item)