Exemplo n.º 1
0
 def mkdir(self, name):
     ap = self._getabs(name)
     if os.path.exists(ap):
         raise AlreadyExists("Already exists")
     else:
         try:
             _org_mkdir(ap)
         except Exception as e:
             raise OperationFailure(str(e))
Exemplo n.º 2
0
 def mkdir(self, name):
     ap = self.abspath(name)
     try:
         self.ftp.mkd(ap)
     except Exception as e:
         # test wether the dir exists
         self.get_path()
         try:
             self.cd(ap)
         except Exception:
             raise e
         else:
             raise AlreadyExists("Already exists!")
         raise OperationFailure(str(e))
Exemplo n.º 3
0
 def mkdir(self, name):
     path = self.abspath(name)
     try:
         self.client.files_create_folder(path)
     except dropbox.exceptions.ApiError as api_e:
         e = api_e.reason
         if e.is_path():
             pe = e.get_path()
             if pe.is_conflict():
                 raise AlreadyExists("Already exists!")
             elif pe.is_insufficient_space():
                 raise OperationFailure("Not enough Space available!")
             elif pe.is_disallowed_name():
                 raise OperationFailure("Disallowed name!")
             elif pe.is_no_write_permission():
                 raise OperationFailure("Permission denied!")
             else:
                 raise OperationFailure(api_e.message)
         else:
             raise OperationFailure("Can not create dir!")