Fix debug output when updatecache parameter is not used in the query string

This commit is contained in:
Benjamin Dauvergne 2014-11-04 11:32:44 +01:00
parent fd74d2f7c1
commit fbe7b87218
1 changed files with 3 additions and 2 deletions

View File

@ -149,6 +149,7 @@ class Data(object):
# If authentication is used
if self.user_context:
pre_hash += '-%s' % unicode(self.request.user).encode('utf-8')
log.debug('key pre hash value %r', pre_hash)
self.key = hashlib.md5(pre_hash).hexdigest()
self.now = time.time()
self.__content = self.__CACHE_SENTINEL
@ -282,14 +283,14 @@ class Data(object):
log.debug('self refresh is 0, ignoring cache')
# do not use cache if updatecache is present in the query string
use_cache = use_cache and (not self.request or 'updatecache' not in self.request.GET)
if self.request and 'updatecache' not in self.request.GET:
if self.request and 'updatecache' in self.request.GET:
log.debug('updatecache in query string, ignoring cache')
if use_cache:
if until < self.now:
# reload cache content asynchronously in a thread
# and return the current content
log.debug('asynchronous update for url %r', self.url)
log.debug('asynchronous update for url %r until: %s < now: %s', self.url, until, self.now)
c = self.CONDITIONS.setdefault(self.key, threading.Condition())
t = threading.Thread(target=self.update_content)
t2 = self.UPDATE_THREADS.setdefault(self.key, t)