| 463 | | self.log.error("Can't delete old attachments directory %s: %s", |
| 464 | | old_dir, exception_to_unicode(e, traceback=True)) |
| 465 | | printerr(_("Error while deleting old attachments directory. " |
| 466 | | "Please move or remove files in\nthe directory and try " |
| 467 | | "again.")) |
| 468 | | raise |
| | 466 | self.log.warning("Can't delete old attachments directory %s: %s", |
| | 467 | old_dir, exception_to_unicode(e)) |
| | 468 | |
| | 469 | # Some unreferenced files remain, inform admin |
| | 470 | stale_name = time.strftime('attachments-stale-%Y%m%d') |
| | 471 | stale_dir = os.path.join(path, stale_name) |
| | 472 | try: |
| | 473 | os.rename(old_dir, stale_dir) |
| | 474 | except OSError, e: |
| | 475 | self.log.warning("Can't move old attachments directory %s: %s", |
| | 476 | old_dir, exception_to_unicode(e)) |
| | 477 | printerr(_("The upgrade of attachments was successful, but some " |
| | 478 | "files weren't referenced in the database. The old " |
| | 479 | "attachments directory\n\n %(dir)s\n\n" |
| | 480 | "could not be moved due to:\n\n %(exception)s\n\n" |
| | 481 | "Please move this directory out of the environment. " |
| | 482 | "Note that Trac won't run as long as the directory " |
| | 483 | "exists.\n", |
| | 484 | dir=stale_dir, exception=exception_to_unicode(e))) |
| | 485 | else: |
| | 486 | printerr(_("The upgrade of attachments was successful, but some " |
| | 487 | "files weren't referenced in the database. They were " |
| | 488 | "moved to:\n\n %(dir)s\n", |
| | 489 | dir=stale_dir)) |