cubicweb/web/views/debug.py
changeset 12026 c21b399c9269
parent 12012 f7ff5217a02f
child 12567 26744ad37953
equal deleted inserted replaced
12025:ba79f4a4f5d8 12026:c21b399c9269
   101             return '%s %s' % (xml_escape(text_type(sval)),
   101             return '%s %s' % (xml_escape(text_type(sval)),
   102                               sname.endswith('percent') and '%' or '')
   102                               sname.endswith('percent') and '%' or '')
   103         pyvalue = [(sname, format_stat(sname, sval))
   103         pyvalue = [(sname, format_stat(sname, sval))
   104                     for sname, sval in sorted(stats.items())]
   104                     for sname, sval in sorted(stats.items())]
   105         self.wview('pyvaltable', pyvalue=pyvalue, header_column_idx=0)
   105         self.wview('pyvaltable', pyvalue=pyvalue, header_column_idx=0)
   106         # open repo sessions
       
   107         if req.user.is_in_group('managers'):
       
   108             w(u'<h3>%s</h3>' % _('opened sessions'))
       
   109             sessions = repo._sessions.values()
       
   110             if sessions:
       
   111                 w(u'<ul>')
       
   112                 for session in sessions:
       
   113                     w(u'<li>%s (%s: %s)<br/>' % (
       
   114                         xml_escape(text_type(session)),
       
   115                         _('last usage'),
       
   116                         strftime(dtformat, localtime(session.timestamp))))
       
   117                     dict_to_html(w, session.data)
       
   118                     w(u'</li>')
       
   119                 w(u'</ul>')
       
   120             else:
       
   121                 w(u'<p>%s</p>' % _('no repository sessions found'))
       
   122         # web server information
   106         # web server information
   123         w(u'<h2>%s</h2>' % _('Web server'))
   107         w(u'<h2>%s</h2>' % _('Web server'))
   124         pyvalue = ((_('base url'), req.base_url()),
   108         pyvalue = ((_('base url'), req.base_url()),
   125                    (_('data directory url'), req.datadir_url))
   109                    (_('data directory url'), req.datadir_url))
   126         self.wview('pyvaltable', pyvalue=pyvalue, header_column_idx=0)
   110         self.wview('pyvaltable', pyvalue=pyvalue, header_column_idx=0)