From b880efba3ef8d42c44e3a9634ab5dd0d1acf3b53 Mon Sep 17 00:00:00 2001 From: helmutm Date: Tue, 30 Mar 2010 13:37:23 +0000 Subject: [PATCH] add utility for caching values in the request git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3794 fd906abe-77d9-0310-91a1-e0d9ade77398 --- zutil/rcache.py | 2 +- zutil/rcache.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zutil/rcache.py b/zutil/rcache.py index d357da2..f48bf15 100644 --- a/zutil/rcache.py +++ b/zutil/rcache.py @@ -31,7 +31,7 @@ def caching(self, method, id): item = annot.setdefault('cybertools.zutil.rcache', {}) value = item.get(id, INVALID) if value is INVALID: - value = method() + value = method(self) item[id] = value return value diff --git a/zutil/rcache.txt b/zutil/rcache.txt index bcc7353..fdba6e5 100644 --- a/zutil/rcache.txt +++ b/zutil/rcache.txt @@ -12,12 +12,12 @@ $Id$ ... self.request = request ... ... @rcache - ... def calculate(): + ... def calculate(self): ... print 'calculating' ... return 42 ... ... @rcacheproperty - ... def value(): + ... def value(self): ... print 'calculating' ... return 43