diff -r 785299dfc2c0 -r fccda6dd91bf web/views/debug.py --- a/web/views/debug.py Fri Feb 26 08:46:27 2010 +0100 +++ b/web/views/debug.py Fri Feb 26 09:54:03 2010 +0100 @@ -25,41 +25,89 @@ w(u'') -class DebugView(StartupView): - __regid__ = 'debug' + +class ProcessInformationView(StartupView): + __regid__ = 'info' __select__ = none_rset() & match_user_groups('managers') - title = _('server debug information') + + title = _('server information') def call(self, **kwargs): """display server information""" + req = self._cw + dtformat = req.property_value('ui.datetime-format') + _ = req._ w = self.w - w(u'

server sessions

') - sessions = self._cw.cnx._repo._sessions.items() + # generic instance information + w(u'

%s

' % _('Instance')) + w(u'') + w(u'' % ( + _('config type'), self._cw.vreg.config.name)) + w(u'' % ( + _('config mode'), self._cw.vreg.config.mode)) + w(u'' % ( + _('instance home'), self._cw.vreg.config.apphome)) + w(u'
%s%s
%s%s
%s%s
') + vcconf = req.vreg.config.vc_config() + w(u'

%s

' % _('versions configuration')) + w(u'') + w(u'' % ( + 'CubicWeb', vcconf.get('cubicweb', _('no version information')))) + for cube in sorted(self._cw.vreg.config.cubes()): + cubeversion = vcconf.get(cube, _('no version information')) + w(u'' % ( + cube, cubeversion)) + w(u'
%s%s
%s%s
') + # repository information + repo = req.vreg.config.repository(None) + w(u'

%s

' % _('Repository')) + w(u'

%s

' % _('resources usage')) + w(u'') + stats = repo.stats() + for element in sorted(stats): + w(u'' + % (element, stats[element], + element.endswith('percent') and '%' or '' )) + w(u'
%s%s %s
') + if req.cnx._cnxtype == 'inmemory': + w(u'

%s

' % _('opened sessions')) + sessions = repo._sessions.values() + if sessions: + w(u'') + else: + w(u'

%s

' % _('no repository sessions found')) + # web server information + w(u'

%s

' % _('Web server')) + w(u'') + w(u'' % ( + _('base url'), req.base_url())) + w(u'' % ( + _('data directory url'), req.datadir_url)) + w(u'
%s%s
%s%s
') + from cubicweb.web.application import SESSION_MANAGER + sessions = SESSION_MANAGER.current_sessions() + w(u'

%s

' % _('opened web sessions')) if sessions: w(u'') else: - w(u'

no server sessions found

') - from cubicweb.web.application import SESSION_MANAGER - w(u'

web sessions

') - sessions = SESSION_MANAGER.current_sessions() - if sessions: - w(u'') - else: - w(u'

no web sessions found

') + w(u'

%s

' % _('no web sessions found')) + class RegistryView(StartupView):