]> code.delx.au - pymsnt/commitdiff
More error information in housekeep.py
authorjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Wed, 2 Nov 2005 00:57:34 +0000 (00:57 +0000)
committerjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Wed, 2 Nov 2005 00:57:34 +0000 (00:57 +0000)
git-svn-id: http://delx.cjb.net/svn/pymsnt/trunk@16 55fbd22a-6204-0410-b2f0-b6c764c7e90a

committer: jamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>

src/housekeep.py

index 6a472ca9761311b186c98435fd12bcbcd53dfcda..c3ed1defd6420bbc95543f8901e159b68fc2f3de 100644 (file)
@@ -66,16 +66,20 @@ def doSpoolPrepCheck():
        print "Checking spool files and stringprepping any if necessary...",
 
        for file in os.listdir(pre):
-               file = xdb.unmangle(file).decode("utf-8")
-               filej = jid.JID(file).full()
-               if(file != filej):
-                       file = xdb.mangle(file)
-                       filej = xdb.mangle(filej)
-                       if(os.path.exists(filej)):
-                               print "Need to move", file, "to", filej, "but the latter exists!\nAborting!"
-                               os.exit(1)
-                       else:
-                               shutil.move(pre + file, pre + filej)
+               try:
+                       file = xdb.unmangle(file).decode("utf-8")
+                       filej = jid.JID(file).full()
+                       if(file != filej):
+                               file = xdb.mangle(file)
+                               filej = xdb.mangle(filej)
+                               if(os.path.exists(filej)):
+                                       print "Need to move", file, "to", filej, "but the latter exists!\nAborting!"
+                                       os.exit(1)
+                               else:
+                                       shutil.move(pre + file, pre + filej)
+               except:
+                       print "File: " + file
+                       raise
        print "done"
 
 
@@ -86,27 +90,34 @@ def doHashDirUpgrade():
        pre = os.path.abspath(config.spooldir) + "/" + config.jid + "/avatars/"
        if os.path.exists(pre):
                for file in os.listdir(pre):
-                       if os.path.isfile(pre + file):
-                               pre2 = pre + file[0:3] + "/"
-                               if not os.path.exists(pre2):
-                                       os.makedirs(pre2)
-                               shutil.move(pre + file, pre2 + file)
+                       try:
+                               if os.path.isfile(pre + file):
+                                       pre2 = pre + file[0:3] + "/"
+                                       if not os.path.exists(pre2):
+                                               os.makedirs(pre2)
+                                       shutil.move(pre + file, pre2 + file)
+                       except:
+                               print "File: " + file
+                               raise
        
        # Do spool files...
        pre = os.path.abspath(config.spooldir) + "/" + config.jid + "/"
        if os.path.exists(pre):
                for file in os.listdir(pre):
-                       if os.path.isfile(pre + file) and file != "notes_to_myself":
-                               hash = file[0:2]
-                               pre2 = pre + hash + "/"
-                               if not os.path.exists(pre2):
-                                       os.makedirs(pre2)
-
-                               if(os.path.exists(pre2 + file)):
-                                       print "Need to move", file, "to", pre2 + file, "but the latter exists!\nAborting!"
-                                       os.exit(1)
-                               else:
-                                       shutil.move(pre + file, pre2 + file)
+                       try:
+                               if os.path.isfile(pre + file) and file != "notes_to_myself":
+                                       hash = file[0:2]
+                                       pre2 = pre + hash + "/"
+                                       if not os.path.exists(pre2):
+                                               os.makedirs(pre2)
+
+                                       if(os.path.exists(pre2 + file)):
+                                               print "Need to move", file, "to", pre2 + file, "but the latter exists!\nAborting!"
+                                               os.exit(1)
+                                       else:
+                                               shutil.move(pre + file, pre2 + file)
+                       except:
+                               print "File: " + file
 
        print "done"