From 7abacb8b6a25dcc0ea19d712174b862e6eedb55e Mon Sep 17 00:00:00 2001 From: xiez Date: Wed, 6 Jun 2012 13:55:55 +0800 Subject: [PATCH] Disable notification cache --- notifications/settings.py | 3 +++ notifications/utils.py | 4 ++-- settings.py | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 notifications/settings.py diff --git a/notifications/settings.py b/notifications/settings.py new file mode 100644 index 0000000000..11060c3a76 --- /dev/null +++ b/notifications/settings.py @@ -0,0 +1,3 @@ +from django.conf import settings + +NOTIFICATION_CACHE_TIMEOUT = getattr(settings, 'NOTIFICATION_CACHE_TIMEOUT', 24*60*60) diff --git a/notifications/utils.py b/notifications/utils.py index c69bcff998..70927203d7 100644 --- a/notifications/utils.py +++ b/notifications/utils.py @@ -1,11 +1,11 @@ from django.core.cache import cache from seahub.notifications.models import Notification - +from seahub.notifications.settings import NOTIFICATION_CACHE_TIMEOUT def refresh_cache(): """ Function to be called when change primary notification. """ cache.set('CUR_TOPINFO', Notification.objects.all().filter(primary=1), - 24*60*60) + NOTIFICATION_CACHE_TIMEOUT) diff --git a/settings.py b/settings.py index 968b584671..56f2255943 100644 --- a/settings.py +++ b/settings.py @@ -185,6 +185,9 @@ AUTO_GENERATE_AVATAR_SIZES = (80, 16) AVATAR_MAX_AVATARS_PER_USER = 1 AVATAR_CACHE_TIMEOUT = 0 +#info-bar notification +NOTIFICATION_CACHE_TIMEOUT = 0 + LOGIN_URL = SITE_ROOT + 'accounts/login' # profile