Changes between Version 1 and Version 2 of Ticket #11151, comment 2
- Timestamp:
- Jun 6, 2013, 1:31:11 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #11151, comment 2
v1 v2 8 8 #!diff 9 9 diff --git a/trac/upgrades/db28.py b/trac/upgrades/db28.py 10 index 4079285.. ce50d11 10064410 index 4079285..15f4091 100644 11 11 --- a/trac/upgrades/db28.py 12 12 +++ b/trac/upgrades/db28.py 13 @@ -23,11 +23,11 @@ def do_upgrade(env, version, cursor): 13 @@ -11,6 +11,7 @@ 14 # individuals. For the exact contribution history, see the revision 15 # history and logs, available at http://trac.edgewall.org/. 16 17 +import errno 18 import os.path 19 20 from trac.attachment import Attachment 21 @@ -23,11 +24,14 @@ def do_upgrade(env, version, cursor): 14 22 the filenames in the process.""" 15 23 path = env.path 16 24 old_dir = os.path.join(path, 'attachments') 17 25 - if not os.path.exists(old_dir): 18 + if not os.path.isdir(old_dir): 19 return 20 old_stat = os.stat(old_dir) 26 - return 27 - old_stat = os.stat(old_dir) 28 + try: 29 + old_stat = os.stat(old_dir) 30 + except OSError, e: 31 + if e.errno == errno.ENOENT: 32 + return 33 + raise 21 34 new_dir = os.path.join(path, 'files', 'attachments') 22 35 - if not os.path.exists(new_dir):