[views/debug] Do not show all web sessions without CNX, just count them (closes #2602161)
--- a/web/views/debug.py Mon Mar 04 17:22:57 2013 +0100
+++ b/web/views/debug.py Tue Jan 29 16:57:44 2013 +0100
@@ -131,10 +131,13 @@
sessions = SESSION_MANAGER.current_sessions()
w(u'<h3>%s</h3>' % _('opened web sessions'))
if sessions:
+ n_no_cnx_sessions = 0
w(u'<ul>')
for session in sessions:
if not session.cnx:
- w(u'<li>%s (NO CNX)</li>' % session.sessionid)
+ # We do not want to list all sessions without cnx
+ # Their session ID are useless, hence we just count them
+ n_no_cnx_sessions += 1
continue
try:
last_usage_time = session.cnx.check()
@@ -148,6 +151,9 @@
dict_to_html(w, session.data)
w(u'</li>')
w(u'</ul>')
+ if n_no_cnx_sessions > 0:
+ w(u'<h3>%s %s</h3>' % (n_no_cnx_sessions,
+ _('web sessions without CNX')))
else:
w(u'<p>%s</p>' % _('no web sessions found'))