no more import stat in cfs.py, thanks Vladyslav

This commit is contained in:
mdipierro
2012-07-11 22:08:11 -05:00
parent 0acbcc31cd
commit 4c5d8f84e7
2 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.00.0 (2012-07-11 22:05:35) dev
Version 2.00.0 (2012-07-11 22:08:08) dev
+7 -6
View File
@@ -13,7 +13,6 @@ FOR INTERNAL USE ONLY
"""
import os
import stat
import thread
from fileutils import read_file
@@ -28,13 +27,15 @@ 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. 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. 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)
This is used on Google App Engine since pyc files cannot be saved.
"""
t = os.stat(filename)[stat.ST_MTIME]
t = os.stat(filename).st_mtime
cfs_lock.acquire()
item = cfs.get(key, None)
cfs_lock.release()
@@ -43,7 +44,7 @@ def getcfs(key, filename, filter=None):
if not filter:
data = read_file(filename)
else:
data = filter()
data = filter(item[1] if item else None)
cfs_lock.acquire()
cfs[key] = (t, data)
cfs_lock.release()