From d1b9ab9fd87d490c79cbab77593f471c8a46efdc Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Tue, 26 Mar 2013 17:08:25 -0400 Subject: [PATCH] Move SERVER_GENERATION definition to settings.py (imported from commit 4be2b912a63f49f525c66f46db0bc5c466ad364f) --- humbug/settings.py | 3 +++ zephyr/tornadoviews.py | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/humbug/settings.py b/humbug/settings.py index 5541a3f767..4348c02a19 100644 --- a/humbug/settings.py +++ b/humbug/settings.py @@ -2,9 +2,12 @@ import os import platform import logging +import time from zephyr.openid import openid_failure_handler +SERVER_GENERATION = int(time.time()) + DEPLOYED = (('humbughq.com' in platform.node()) or os.path.exists('/etc/humbug-server')) STAGING_DEPLOYED = (platform.node() == 'staging.humbughq.com') diff --git a/zephyr/tornadoviews.py b/zephyr/tornadoviews.py index 055ff6e8ca..118783faaf 100644 --- a/zephyr/tornadoviews.py +++ b/zephyr/tornadoviews.py @@ -21,8 +21,6 @@ import time import sys import logging -SERVER_GENERATION = int(time.time()) - @internal_notify_view def notify(request): process_notification(simplejson.loads(request.POST['data'])) @@ -55,7 +53,7 @@ def format_updates_response(messages=[], apply_markdown=True, "msg": "", 'update_types': update_types} if client_server_generation is not None: - ret['server_generation'] = SERVER_GENERATION + ret['server_generation'] = settings.SERVER_GENERATION if new_pointer is not None: ret['new_pointer'] = new_pointer @@ -71,7 +69,7 @@ def return_messages_immediately(user_profile, client_id, last, update_types.append("nonblocking_request") if (client_server_generation is not None and - client_server_generation != SERVER_GENERATION): + client_server_generation != settings.SERVER_GENERATION): update_types.append("client_reload") ptr = get_user_pointer(user_profile.id)