[gen] Added config param 'enableSessionTimeout' for enabling/disabling session timeout (disabled by default).

This commit is contained in:
Gaetan Delannay 2012-12-15 23:36:56 +01:00
parent 1e3a8ba351
commit 70b18f597f
4 changed files with 13 additions and 1 deletions

View file

@ -1456,7 +1456,11 @@ class Boolean(Type):
label, sdefault, scolspan) label, sdefault, scolspan)
self.pythonType = bool self.pythonType = bool
# Layout including a description
dLayouts = {'view': 'lf', 'edit': Table('flrv;=d', width=None)} dLayouts = {'view': 'lf', 'edit': Table('flrv;=d', width=None)}
# Centered layout, no description
cLayouts = {'view': 'lf|', 'edit': 'flrv|'}
def getDefaultLayouts(self): def getDefaultLayouts(self):
return {'view': 'lf', 'edit': Table('f;lrv;=', width=None)} return {'view': 'lf', 'edit': Table('f;lrv;=', width=None)}
@ -2925,6 +2929,8 @@ class Config:
self.sourceLanguage = 'en' self.sourceLanguage = 'en'
# Activate or not the button on home page for asking a new password # Activate or not the button on home page for asking a new password
self.activateForgotPassword = True self.activateForgotPassword = True
# Enable session timeout?
self.enableSessionTimeout = False
# When using Ogone, place an instance of appy.gen.ogone.OgoneConfig in # When using Ogone, place an instance of appy.gen.ogone.OgoneConfig in
# the field below. # the field below.
self.ogone = None self.ogone = None

View file

@ -603,6 +603,7 @@ class ZopeGenerator(Generator):
repls['languages'] = ','.join('"%s"' % l for l in self.config.languages) repls['languages'] = ','.join('"%s"' % l for l in self.config.languages)
repls['languageSelector'] = self.config.languageSelector repls['languageSelector'] = self.config.languageSelector
repls['sourceLanguage'] = self.config.sourceLanguage repls['sourceLanguage'] = self.config.sourceLanguage
repls['enableSessionTimeout'] = self.config.enableSessionTimeout
repls['ogone'] = repr(self.config.ogone) repls['ogone'] = repr(self.config.ogone)
repls['activateForgotPassword'] = self.config.activateForgotPassword repls['activateForgotPassword'] = self.config.activateForgotPassword
self.copyFile('config.pyt', repls, destName='config.py') self.copyFile('config.pyt', repls, destName='config.py')

View file

@ -318,7 +318,11 @@ class ZopeInstaller:
# Register a function warning us when a session object is deleted. When # Register a function warning us when a session object is deleted. When
# launching Zope in test mode, the temp folder does not exist. # launching Zope in test mode, the temp folder does not exist.
if not hasattr(self.app, 'temp_folder'): return if not hasattr(self.app, 'temp_folder'): return
self.app.temp_folder.session_data.setDelNotificationTarget(onDelSession) sessionData = self.app.temp_folder.session_data
if self.config.enableSessionTimeout:
sessionData.setDelNotificationTarget(onDelSession)
else:
sessionData.setDelNotificationTarget(None)
def enableUserTracking(self): def enableUserTracking(self):
'''Enables the machinery allowing to know who is currently logged in. '''Enables the machinery allowing to know who is currently logged in.

View file

@ -48,6 +48,7 @@ languages = [<!languages!>]
languageSelector = <!languageSelector!> languageSelector = <!languageSelector!>
sourceLanguage = '<!sourceLanguage!>' sourceLanguage = '<!sourceLanguage!>'
activateForgotPassword = <!activateForgotPassword!> activateForgotPassword = <!activateForgotPassword!>
enableSessionTimeout = <!enableSessionTimeout!>
ogone = <!ogone!> ogone = <!ogone!>
# When Zope is starting or runs in test mode, there is no request object. We # When Zope is starting or runs in test mode, there is no request object. We