18 """management and error screens""" |
18 """management and error screens""" |
19 |
19 |
20 from cubicweb import _ |
20 from cubicweb import _ |
21 |
21 |
22 from time import strftime, localtime |
22 from time import strftime, localtime |
23 |
|
24 from six import text_type |
|
25 |
23 |
26 from logilab.mtconverter import xml_escape |
24 from logilab.mtconverter import xml_escape |
27 |
25 |
28 from cubicweb.predicates import none_rset, match_user_groups |
26 from cubicweb.predicates import none_rset, match_user_groups |
29 from cubicweb.view import StartupView |
27 from cubicweb.view import StartupView |
96 if k == 'type_cache_size': |
94 if k == 'type_cache_size': |
97 continue |
95 continue |
98 if k.endswith('_cache_size'): |
96 if k.endswith('_cache_size'): |
99 stats[k] = '%s / %s' % (stats[k]['size'], stats[k]['maxsize']) |
97 stats[k] = '%s / %s' % (stats[k]['size'], stats[k]['maxsize']) |
100 def format_stat(sname, sval): |
98 def format_stat(sname, sval): |
101 return '%s %s' % (xml_escape(text_type(sval)), |
99 return '%s %s' % (xml_escape(str(sval)), |
102 sname.endswith('percent') and '%' or '') |
100 sname.endswith('percent') and '%' or '') |
103 pyvalue = [(sname, format_stat(sname, sval)) |
101 pyvalue = [(sname, format_stat(sname, sval)) |
104 for sname, sval in sorted(stats.items())] |
102 for sname, sval in sorted(stats.items())] |
105 self.wview('pyvaltable', pyvalue=pyvalue, header_column_idx=0) |
103 self.wview('pyvaltable', pyvalue=pyvalue, header_column_idx=0) |
106 # web server information |
104 # web server information |