Esempio n. 1
0
 def update_res(self, old: str, new: str) -> None:
     if old != new:
         if res.name_exist(self.res_path, old):
             if not res.name_exist(self.res_path, new):
                 res.update(self.res_path, old, new)
             else:
                 raise ResourceError(subcode=ResourceError.res_exist,
                                     data=ResourceError.res_exist_mes % new)
         else:
             raise ResourceError(subcode=ResourceError.res_not_found,
                                 data=ResourceError.res_not_found_mes % old)
Esempio n. 2
0
 def generate_new_res(self, name: str) -> None:
     if not res.name_exist(self.res_path, name):
         res.create(self.res_path, name)
     else:
         raise ResourceError(subcode=ResourceError.res_exist,
                             data=ResourceError.res_not_found_mes % name)
Esempio n. 3
0
 def delete_res(self, name: str) -> None:
     if res.name_exist(self.res_path, name):
         res.delete(merge(self.res_path, name))