From 39e8cfb11a72dd7eda316e74ccb49590214beb50 Mon Sep 17 00:00:00 2001 From: niphlod Date: Fri, 7 Oct 2016 21:14:56 +0200 Subject: [PATCH] fix ccache page in appadmin, thanks MDSIII fixes the ccache page to now raise an exception if a dict is stored in cache --- applications/admin/controllers/appadmin.py | 9 ++++----- applications/examples/controllers/appadmin.py | 9 ++++----- applications/welcome/controllers/appadmin.py | 3 +-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/applications/admin/controllers/appadmin.py b/applications/admin/controllers/appadmin.py index 3060945c8..c5ba354e5 100644 --- a/applications/admin/controllers/appadmin.py +++ b/applications/admin/controllers/appadmin.py @@ -213,7 +213,7 @@ def select(): if is_imap: step = 3 - + stop = start + step table = None @@ -409,7 +409,7 @@ def ccache(): import copy import time import math - from gluon import portalocker + from pydal.contrib import portalocker ram = { 'entries': 0, @@ -421,7 +421,7 @@ def ccache(): 'oldest': time.time(), 'keys': [] } - + disk = copy.copy(ram) total = copy.copy(ram) disk['keys'] = [] @@ -465,8 +465,7 @@ def GetInHMS(seconds): ram['keys'].append((key, GetInHMS(time.time() - value[0]))) for key in cache.disk.storage: - value = cache.disk.storage[key] - if isinstance(value[1], dict): + if key == 'web2py_cache_statistics' and isinstance(value[1], dict): disk['hits'] = value[1]['hit_total'] - value[1]['misses'] disk['misses'] = value[1]['misses'] try: diff --git a/applications/examples/controllers/appadmin.py b/applications/examples/controllers/appadmin.py index 3060945c8..c5ba354e5 100644 --- a/applications/examples/controllers/appadmin.py +++ b/applications/examples/controllers/appadmin.py @@ -213,7 +213,7 @@ def select(): if is_imap: step = 3 - + stop = start + step table = None @@ -409,7 +409,7 @@ def ccache(): import copy import time import math - from gluon import portalocker + from pydal.contrib import portalocker ram = { 'entries': 0, @@ -421,7 +421,7 @@ def ccache(): 'oldest': time.time(), 'keys': [] } - + disk = copy.copy(ram) total = copy.copy(ram) disk['keys'] = [] @@ -465,8 +465,7 @@ def GetInHMS(seconds): ram['keys'].append((key, GetInHMS(time.time() - value[0]))) for key in cache.disk.storage: - value = cache.disk.storage[key] - if isinstance(value[1], dict): + if key == 'web2py_cache_statistics' and isinstance(value[1], dict): disk['hits'] = value[1]['hit_total'] - value[1]['misses'] disk['misses'] = value[1]['misses'] try: diff --git a/applications/welcome/controllers/appadmin.py b/applications/welcome/controllers/appadmin.py index 4d4e965fb..c5ba354e5 100644 --- a/applications/welcome/controllers/appadmin.py +++ b/applications/welcome/controllers/appadmin.py @@ -465,8 +465,7 @@ def GetInHMS(seconds): ram['keys'].append((key, GetInHMS(time.time() - value[0]))) for key in cache.disk.storage: - value = cache.disk.storage[key] - if isinstance(value[1], dict): + if key == 'web2py_cache_statistics' and isinstance(value[1], dict): disk['hits'] = value[1]['hit_total'] - value[1]['misses'] disk['misses'] = value[1]['misses'] try: