diff -r 4af48b1aaf29 -r 6d5f0ccf31b8 web/views/management.py --- a/web/views/management.py Fri Apr 17 08:52:05 2009 +0200 +++ b/web/views/management.py Fri Apr 17 09:32:57 2009 +0200 @@ -17,6 +17,9 @@ _ = unicode +SUBMIT_MSGID = _('Submit bug report') +MAIL_SUBMIT_MSGID = _('Submit bug report by mail') + def begin_form(w, entity, redirectvid, redirectpath=None, msg=None): w(u'
\n' % entity.req.build_url('edit')) w(u'
\n') @@ -185,10 +188,10 @@ def call(self): req = self.req.reset_headers() - _ = req._; w = self.w + w = self.w ex = req.data.get('ex')#_("unable to find exception information")) excinfo = req.data.get('excinfo') - title = _('an error occured') + title = self.req._('an error occured') w(u'

%s

' % title) if 'errmsg' in req.data: ex = req.data['errmsg'] @@ -212,39 +215,32 @@ return vcconf = self.config.vc_config() w(u"
") - eversion = vcconf.get('cubicweb', _('no version information')) + eversion = vcconf.get('cubicweb', self.req._('no version information')) # NOTE: tuple wrapping needed since eversion is itself a tuple w(u"CubicWeb version: %s
\n" % (eversion,)) - for pkg in self.config.cubes(): - pkgversion = vcconf.get(pkg, _('no version information')) - w(u"Package %s version: %s
\n" % (pkg, pkgversion)) + cversions = [] + for cube in self.config.cubes(): + cubeversion = vcconf.get(cube, self.req._('no version information')) + w(u"Package %s version: %s
\n" % (cube, cubeversion)) + cversions.append((cube, cubeversion)) w(u"
") # creates a bug submission link if SUBMIT_URL is set submiturl = self.config['submit-url'] - if submiturl: - binfo = text_error_description(ex, excinfo, req, eversion, - [(pkg, vcconf.get(pkg, _('no version information'))) - for pkg in self.config.cubes()]) - w(u'\n' % html_escape(submiturl)) - w(u'
\n') - w(u'' % html_escape(binfo)) - w(u'') - w(u'') - w(u'' % _('Submit bug report')) - w(u'
\n') - w(u'\n') submitmail = self.config['submit-mail'] - if submitmail: - binfo = text_error_description(ex, excinfo, req, eversion, - [(pkg, vcconf.get(pkg, _('no version information'))) - for pkg in self.config.cubes()]) - w(u'
\n' % req.build_url('reportbug')) - w(u'
\n') - w(u'' % html_escape(binfo)) - w(u'') - w(u'' % _('Submit bug report by mail')) - w(u'
\n') - w(u'
\n') + if submiturl or submitmail: + form = FieldsForm(self.req, set_error_url=False) + binfo = text_error_description(ex, excinfo, req, eversion, cversions) + form.form_add_hidden('description', binfo) + form.form_add_hidden('__bugreporting', '1') + if submitmail: + form.form_buttons = [SubmitButton(MAIL_SUBMIT_MSGID)] + form.action = req.build_url('reportbug') + w(form.form_render()) + if submiturl: + form.form_add_hidden('description_format', 'text/rest') + form.form_buttons = [SubmitButton(SUBMIT_MSGID)] + form.action = submiturl + w(form.form_render()) def exc_message(ex, encoding): @@ -268,6 +264,7 @@ binfo += '\n' return binfo + class ProcessInformationView(StartupView): id = 'info' __select__ = none_rset() & match_user_groups('managers')