[Oval-commits] r162 - trunk/oval-server/dsaSync

Pavel Vinogradov blaze-guest at alioth.debian.org
Mon Aug 20 07:25:17 UTC 2007


Author: blaze-guest
Date: 2007-08-20 07:25:17 +0000 (Mon, 20 Aug 2007)
New Revision: 162

Modified:
   trunk/oval-server/dsaSync/sync.py
Log:
Fix error in mtime calculation

Modified: trunk/oval-server/dsaSync/sync.py
===================================================================
--- trunk/oval-server/dsaSync/sync.py	2007-08-20 07:03:28 UTC (rev 161)
+++ trunk/oval-server/dsaSync/sync.py	2007-08-20 07:25:17 UTC (rev 162)
@@ -19,10 +19,20 @@
 		time = datetime(1990, 1, 1, 00, 00, 00)
 		
 		if (os.access(self.dsaStorage, os.R_OK)):
-			for path in os.listdir(self.dsaStorage):
-				mtime = datetime.fromtimestamp(os.stat(self.dsaStorage+os.sep+path)[ST_MTIME])
-				if mtime > time and os.path.isfile(path):
-					time = mtime
+			directory = self.dsaStorage
+			
+			def getDirUpdateDate(dir):
+				time = datetime(1990, 1, 1, 00, 00, 00)
+				for path in os.listdir(dir):
+					if os.path.isfile(dir+os.sep+path):
+						mtime = datetime.fromtimestamp(os.stat(dir+os.sep+path)[ST_MTIME])
+					else:
+						mtime = getDirUpdateDate(dir+os.sep+path)
+					if mtime > time:
+						time = mtime
+				return time
+			
+			time = getDirUpdateDate (directory)
 		else:
 			os.mkdir(self.dsaStorage)
 		self.actual = time




More information about the Oval-commits mailing list