From b6ac16dfe45437378c5683777e4e20283219803a Mon Sep 17 00:00:00 2001 From: Eric Price Date: Mon, 2 Jun 2008 23:59:50 -0400 Subject: [PATCH] Avoid per-request global state. svn path=/trunk/packages/sipb-xen-www/; revision=578 --- code/main.py | 4 ++-- code/webcommon.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/code/main.py b/code/main.py index 70e9a2a..620c0b9 100755 --- a/code/main.py +++ b/code/main.py @@ -41,7 +41,7 @@ import sipb_xen_database from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type, Autoinstall import validation import cache_acls -from webcommon import InvalidInput, CodeError, state +from webcommon import InvalidInput, CodeError, State import controls class Checkpoint: @@ -667,7 +667,7 @@ if __name__ == '__main__': logging.getLogger('sqlalchemy.orm.unitofwork').setLevel(logging.INFO) username = getUser(os.environ) - state.username = username + state = State(username) operation = os.environ.get('PATH_INFO', '') if not operation: print "Status: 301 Moved Permanently" diff --git a/code/webcommon.py b/code/webcommon.py index 5911787..9a9453a 100644 --- a/code/webcommon.py +++ b/code/webcommon.py @@ -54,5 +54,3 @@ class State(object): for attr in list(self.__dict__): if attr.startswith('__cache_'): delattr(self, attr) - -state = State(None) -- 1.7.9.5