Changes between Version 1 and Version 2 of Ticket #11151, comment 2


Ignore:
Timestamp:
Jun 6, 2013, 3:31:11 PM (19 months ago)
Author:
jun66j5
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11151, comment 2

    v1 v2  
    88#!diff
    99diff --git a/trac/upgrades/db28.py b/trac/upgrades/db28.py
    10 index 4079285..ce50d11 100644
     10index 4079285..15f4091 100644
    1111--- a/trac/upgrades/db28.py
    1212+++ 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):
    1422     the filenames in the process."""
    1523     path = env.path
    1624     old_dir = os.path.join(path, 'attachments')
    1725-    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
    2134     new_dir = os.path.join(path, 'files', 'attachments')
    2235-    if not os.path.exists(new_dir):