reverted cfs.py
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.00.0 (2012-07-11 22:10:11) dev
|
||||
Version 2.00.0 (2012-07-11 22:11:17) dev
|
||||
|
||||
+6
-7
@@ -13,6 +13,7 @@ FOR INTERNAL USE ONLY
|
||||
"""
|
||||
|
||||
import os
|
||||
import stat
|
||||
import thread
|
||||
from fileutils import read_file
|
||||
|
||||
@@ -27,15 +28,13 @@ def getcfs(key, filename, filter=None):
|
||||
|
||||
:param key: the cache key
|
||||
:param filename: the file to cache
|
||||
:param filter: is the function used for filtering. Previous stored data
|
||||
(or None) are passed to this function as a parameter (READONLY!!).
|
||||
Normally `filename` is a .py file and `filter` is a function that
|
||||
bytecode compiles the file. In this way the bytecode compiled file
|
||||
is cached. (Default = None)
|
||||
:param filter: is the function used for filtering. Normally `filename` is a
|
||||
.py file and `filter` is a function that bytecode compiles the file.
|
||||
In this way the bytecode compiled file is cached. (Default = None)
|
||||
|
||||
This is used on Google App Engine since pyc files cannot be saved.
|
||||
"""
|
||||
t = os.stat(filename).st_mtime
|
||||
t = os.stat(filename)[stat.ST_MTIME]
|
||||
cfs_lock.acquire()
|
||||
item = cfs.get(key, None)
|
||||
cfs_lock.release()
|
||||
@@ -44,7 +43,7 @@ def getcfs(key, filename, filter=None):
|
||||
if not filter:
|
||||
data = read_file(filename)
|
||||
else:
|
||||
data = filter(item[1]) if item else filter()
|
||||
data = filter()
|
||||
cfs_lock.acquire()
|
||||
cfs[key] = (t, data)
|
||||
cfs_lock.release()
|
||||
|
||||
Reference in New Issue
Block a user