# HG changeset patch # User Sverre Rabbelier # Date 1251485387 25200 # Node ID 0181649aa7b0078e4532683e22551fcd03af66df # Parent aff661c7f936140ec936a7a009d4ef526f547a78 Use per-request store to store access rights diff -r aff661c7f936 -r 0181649aa7b0 app/soc/views/helper/access.py --- a/app/soc/views/helper/access.py Fri Aug 28 11:48:27 2009 -0700 +++ b/app/soc/views/helper/access.py Fri Aug 28 11:49:47 2009 -0700 @@ -31,8 +31,6 @@ ] -from google.appengine.api import memcache - from django.utils.translation import ugettext from soc.logic import dicts @@ -55,6 +53,7 @@ from soc.logic.models.student_proposal import logic as student_proposal_logic from soc.logic.models.timeline import logic as timeline_logic from soc.logic.models.user import logic as user_logic +from soc.modules import callback from soc.views.helper import redirects from soc.views import out_of_band @@ -280,6 +279,7 @@ self.rights = base.rights if base else {} self.id = None self.user = None + self.core = callback.getCore() def normalizeChecker(self, checker): """Normalizes the checker to a pre-defined format. @@ -314,25 +314,21 @@ """Returns the key for the specified checker for the current user. """ - return "%s.%s" % (self.id, checker_name) + return "checker.%s.%s" % (self.id, checker_name) def put(self, checker_name, value): """Puts the result for the specified checker in the cache. """ - retention = 30 - - memcache_key = self.key(checker_name) - # pylint: disable-msg=E1101 - memcache.add(memcache_key, value, retention) + cache_key = self.key(checker_name) + self.core.setRequestValue(cache_key, value) def get(self, checker_name): """Retrieves the result for the specified checker from cache. """ - memcache_key = self.key(checker_name) - # pylint: disable-msg=E1101 - return memcache.get(memcache_key) + cache_key = self.key(checker_name) + return self.core.getRequestValue(cache_key) def doCheck(self, checker_name, django_args, args): """Runs the specified checker with the specified arguments.