From 4b4d149add5af04546bd0ca9a68fbec4b5179396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 26 Jan 2012 13:50:34 +0100 Subject: [PATCH] Add title to send_bugreport and fix recall review229005 --- tryton/common/common.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/tryton/common/common.py b/tryton/common/common.py index 01d607a5c4..7403b3528e 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -808,15 +808,15 @@ class ErrorDialog(UniqueDialog): if title == details: title = '' log = logging.getLogger('common.message') - log.error(details) + log.error(details + '\n' + title) response = super(ErrorDialog, self).__call__(title, details) if response == gtk.RESPONSE_OK: - send_bugtracker(details) + send_bugtracker(title, details) error = ErrorDialog() -def send_bugtracker(msg): +def send_bugtracker(title, msg): from tryton import rpc parent = get_toplevel_window() win = gtk.Dialog(_('Bug Tracker'), parent, @@ -878,18 +878,11 @@ def send_bugtracker(msg): server = xmlrpclib.Server(('%s://%s:%s@' + CONFIG['roundup.xmlrpc']) % (protocol, user, password), allow_none=True) if hashlib: - msg_md5 = hashlib.md5(msg).hexdigest() + msg_md5 = hashlib.md5(msg + '\n' + title).hexdigest() else: - msg_md5 = md5.new(msg).hexdigest() - # use the last line of the message as title - title = '[no title]' - for line in msg.splitlines(): - #don't use empty line nor ^ from sql error - if line and '^' != line.strip(): - if len(line) > 128: - title = line[:128] + '...' - else: - title = line + msg_md5 = md5.new(msg + '\n' + title).hexdigest() + if not title: + title = '[no title]' issue_id = None msg_ids = server.filter('msg', None, {'summary': str(msg_md5)}) if msg_ids: @@ -918,7 +911,7 @@ def send_bugtracker(msg): and 'roundup.cgi.exceptions.Unauthorised' in exception.faultString): message(_('Connection error!\nBad username or password!')) - return send_bugtracker(msg) + return send_bugtracker(title, msg) tb_s = reduce(lambda x, y: x + y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))