--- a/web/application.py Mon Aug 17 19:21:26 2009 +0200
+++ b/web/application.py Mon Aug 17 19:21:45 2009 +0200
@@ -31,17 +31,17 @@
"""manage session data associated to a session identifier"""
id = 'sessionmanager'
- def __init__(self):
- self.session_time = self.vreg.config['http-session-time'] or None
+ def __init__(self, vreg):
+ self.session_time = vreg.config['http-session-time'] or None
assert self.session_time is None or self.session_time > 0
- self.cleanup_session_time = self.vreg.config['cleanup-session-time'] or 43200
+ self.cleanup_session_time = vreg.config['cleanup-session-time'] or 43200
assert self.cleanup_session_time > 0
- self.cleanup_anon_session_time = self.vreg.config['cleanup-anonymous-session-time'] or 120
+ self.cleanup_anon_session_time = vreg.config['cleanup-anonymous-session-time'] or 120
assert self.cleanup_anon_session_time > 0
if self.session_time:
assert self.cleanup_session_time < self.session_time
assert self.cleanup_anon_session_time < self.session_time
- self.authmanager = self.vreg['components'].select('authmanager')
+ self.authmanager = vreg['components'].select('authmanager', vreg=vreg)
def clean_sessions(self):
"""cleanup sessions which has not been unused since a given amount of
@@ -92,6 +92,10 @@
class AbstractAuthenticationManager(component.Component):
"""authenticate user associated to a request and check session validity"""
id = 'authmanager'
+ vreg = None # XXX necessary until property for deprecation warning is on appobject
+
+ def __init__(self, vreg):
+ self.vreg = vreg
def authenticate(self, req):
"""authenticate user and return corresponding user object
@@ -113,7 +117,8 @@
def __init__(self, appli):
self.vreg = appli.vreg
- self.session_manager = self.vreg['components'].select('sessionmanager')
+ self.session_manager = self.vreg['components'].select('sessionmanager',
+ vreg=self.vreg)
global SESSION_MANAGER
SESSION_MANAGER = self.session_manager
if not 'last_login_time' in self.vreg.schema:
@@ -122,7 +127,8 @@
def reset_session_manager(self):
data = self.session_manager.dump_data()
- self.session_manager = self.vreg['components'].select('sessionmanager')
+ self.session_manager = self.vreg['components'].select('sessionmanager',
+ vreg=self.vreg)
self.session_manager.restore_data(data)
global SESSION_MANAGER
SESSION_MANAGER = self.session_manager
@@ -252,7 +258,8 @@
CW_EVENT_MANAGER.bind('after-registry-reload', self.set_urlresolver)
def set_urlresolver(self):
- self.url_resolver = self.vreg['components'].select('urlpublisher')
+ self.url_resolver = self.vreg['components'].select('urlpublisher',
+ vreg=self.vreg)
def connect(self, req):
"""return a connection for a logged user object according to existing