Cache the file only if not yet cached !
authorFrederic Jolliton <frederic@jolliton.com>
Wed, 9 Mar 2005 14:14:56 +0000 (14:14 +0000)
committerFrederic Jolliton <frederic@jolliton.com>
Wed, 9 Mar 2005 14:14:56 +0000 (14:14 +0000)
git-archimport-id: frederic@jolliton.com--2005-private/confparser--main--0.1--patch-8

confparser.py

index 1d09319..aa4b6fe 100644 (file)
@@ -166,7 +166,7 @@ def readConfiguration( filename , validator = None ) :
                #
                r = readCachedConfiguration( filename )
                cached = False
                #
                r = readCachedConfiguration( filename )
                cached = False
-               if r :
+               if r is not None :
                        conf , isValid = r
                        cached = True
                else :
                        conf , isValid = r
                        cached = True
                else :
@@ -183,10 +183,12 @@ def readConfiguration( filename , validator = None ) :
                        if validator is not None :
                                basicvalidator.validate( conf , validator )
                                isValid = True
                        if validator is not None :
                                basicvalidator.validate( conf , validator )
                                isValid = True
+                               cached = False
                #
                # 4. Keep cached result
                #
                #
                # 4. Keep cached result
                #
-               writeCachedConfiguration( filename , conf , isValid )
+               if not cached :
+                       writeCachedConfiguration( filename , conf , isValid )
        except IOError , e :
                if e[ 0 ] == errno.ENOENT :
                        conf = None
        except IOError , e :
                if e[ 0 ] == errno.ENOENT :
                        conf = None