Changeset af2454
- Timestamp:
- 05/29/2011 10:37:31 AM (14 years ago)
- Branches:
- 2.0.x, develop, extjs4-port, master
- Children:
- 042ddd
- Parents:
- 6dc393
- git-author:
- Pedro Algarvio <pedro@algarvio.me> (05/29/2011 10:35:12 AM)
- git-committer:
- Pedro Algarvio <pedro@algarvio.me> (05/29/2011 10:37:31 AM)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
deluge/plugins/autoadd/autoadd/core.py
r6dc393 raf2454 227 227 self.invalid_torrents[filename] += 1 228 228 if self.invalid_torrents[filename] >= MAX_NUM_ATTEMPTS: 229 log.warning("Maximum attepts reached while trying " 230 "to add the torrent file with the path" 231 " %s", filepath) 229 log.warning( 230 "Maximum attempts reached while trying to add the " 231 "torrent file with the path %s", filepath 232 ) 232 233 os.rename(filepath, filepath + ".invalid") 233 234 del self.invalid_torrents[filename] … … 262 263 elif watchdir.get('copy_torrent_toggle'): 263 264 copy_torrent_path = watchdir['copy_torrent'] 265 copy_torrent_file = os.path.join(copy_torrent_path, filename) 264 266 log.debug("Moving added torrent file \"%s\" to \"%s\"", 265 267 os.path.basename(filepath), copy_torrent_path) 266 os.rename( 267 filepath, os.path.join(copy_torrent_path, filename) 268 ) 268 try: 269 os.rename(filepath, copy_torrent_file) 270 except OSError, why: 271 if why.errno == 18: 272 # This can happen for different mount points 273 from shutil import copyfile 274 try: 275 copyfile(filepath, copy_torrent_file) 276 os.remove(filepath) 277 except OSError: 278 # Last Resort! 279 try: 280 open(copy_torrent_file, 'wb').write( 281 open(filepath, 'rb').read() 282 ) 283 except OSError, why: 284 raise why 285 else: 286 os.remove(filepath) 287 else: 288 os.remove(filepath) 289 else: 290 raise why 269 291 else: 270 292 os.remove(filepath) 271 293 272 294 def on_update_watchdir_error(self, failure, watchdir_id): 273 """Disables any watch folders with un handled exceptions."""295 """Disables any watch folders with un-handled exceptions.""" 274 296 self.disable_watchdir(watchdir_id) 275 297 log.error("Disabling '%s', error during update: %s",
Note:
See TracChangeset
for help on using the changeset viewer.