From 4c5d8f84e7d5761e11fd9054dbd8a89c5e2ce93c Mon Sep 17 00:00:00 2001 From: mdipierro Date: Wed, 11 Jul 2012 22:08:11 -0500 Subject: [PATCH] no more import stat in cfs.py, thanks Vladyslav --- VERSION | 2 +- gluon/cfs.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 855c1134..99fcee8e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-07-11 22:05:35) dev +Version 2.00.0 (2012-07-11 22:08:08) dev diff --git a/gluon/cfs.py b/gluon/cfs.py index c0110234..b7a22e29 100644 --- a/gluon/cfs.py +++ b/gluon/cfs.py @@ -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()