[Zope-Checkins] CVS: Zope/lib/python/OFS - Application.py:1.169
Chris McDonough
chrism@zope.com
Wed, 21 Nov 2001 17:49:31 -0500
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv11861
Modified Files:
Application.py
Log Message:
Added the ability to specify a temp_folder/session_data max limit via ZSESSION_OBJECT_LIMIT evironment variable.
=== Zope/lib/python/OFS/Application.py 1.168 => 1.169 ===
addnotify = env_has('ZSESSION_ADD_NOTIFY', None)
delnotify = env_has('ZSESSION_DEL_NOTIFY', None)
+ default_limit = 1000
+ limit = env_has('ZSESSION_OBJECT_LIMIT', default_limit)
+ try:
+ limit=int(limit)
+ if limit != default_limit:
+ LOG('Zope Default Object Creation', INFO,
+ ('using ZSESSION_OBJECT_LIMIT-specified max objects '
+ 'value of %s' % limit))
+ except ValueError:
+ LOG('Zope Default Object Creation', WARNING,
+ ('Noninteger value %s specified for ZSESSION_OBJECT_LIMIT, '
+ 'defaulting to %s' % (limit, default_limit)))
+ limit = default_limit
if addnotify and app.unrestrictedTraverse(addnotify, None) is None:
LOG('Zope Default Object Creation', WARNING,
('failed to use nonexistent "%s" script as '
@@ -458,7 +471,7 @@
toc = TransientObjectContainer('session_data',
'Session Data Container', addNotification = addnotify,
- delNotification = delnotify)
+ delNotification = delnotify, limit=limit)
timeout_spec = env_has('ZSESSION_TIMEOUT_MINS', '')
if timeout_spec:
try:
@@ -473,7 +486,8 @@
'value of %s' % timeout_spec))
toc = TransientObjectContainer('session_data',
'Session Data Container', timeout_mins = timeout_spec,
- addNotification=addnotify, delNotification = delnotify)
+ addNotification=addnotify, delNotification = delnotify,
+ limit=limit)
tf._setObject('session_data', toc)
tf_reserved = getattr(tf, '_reserved_names', ())
if 'session_data' not in tf_reserved: