You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2008/03/04 21:23:40 UTC

svn commit: r633623 - in /incubator/qpid/trunk/qpid/python/qpid: spec010.py util.py

Author: rhs
Date: Tue Mar  4 12:23:38 2008
New Revision: 633623

URL: http://svn.apache.org/viewvc?rev=633623&view=rev
Log:
check the mtime of the cached spec against the code that generates it

Modified:
    incubator/qpid/trunk/qpid/python/qpid/spec010.py
    incubator/qpid/trunk/qpid/python/qpid/util.py

Modified: incubator/qpid/trunk/qpid/python/qpid/spec010.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/spec010.py?rev=633623&r1=633622&r2=633623&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/spec010.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/spec010.py Tue Mar  4 12:23:38 2008
@@ -17,8 +17,9 @@
 # under the License.
 #
 
-import datatypes
+import os, cPickle, datatypes
 from codec010 import StringCodec
+from util import mtime
 
 class Node:
 
@@ -598,11 +599,9 @@
   def do_exception(self, e):
     return Exception(id(e["@name"]), id(e["@error-code"]), self.children(e))
 
-import os, cPickle
-
 def load(xml):
   fname = xml + ".pcl"
-  if os.path.exists(fname):
+  if os.path.exists(fname) and mtime(fname) > mtime(__file__):
     file = open(fname, "r")
     s = cPickle.load(file)
     file.close()

Modified: incubator/qpid/trunk/qpid/python/qpid/util.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/util.py?rev=633623&r1=633622&r2=633623&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/util.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/util.py Tue Mar  4 12:23:38 2008
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-import socket
+import os, socket
 
 def connect(host, port):
   sock = socket.socket()
@@ -37,3 +37,6 @@
   while predicate():
     s, a = sock.accept()
     yield s
+
+def mtime(filename):
+  return os.stat(filename).st_mtime