From f3ec952b3d11fd35babdcffdaa7c2de38be707eb Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sun, 30 Mar 2014 13:44:24 +0200 Subject: [PATCH] fix parsing comments on redmine 2.4 --- modules/redmine/pages/issues.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/redmine/pages/issues.py b/modules/redmine/pages/issues.py index 35861283..50315677 100644 --- a/modules/redmine/pages/issues.py +++ b/modules/redmine/pages/issues.py @@ -459,14 +459,16 @@ class IssuePage(NewIssuePage): if m: update['author'] = (0, to_unicode(m.group(1))) update['date'] = self.parse_datetime(div.xpath('.//h4//a[last()]')[0].attrib['title']) - if div.find('div') is not None: - comment = div.find('div') + + comments = div.xpath('.//div[starts-with(@id, "journal-")]') + if len(comments) > 0: + comment = comments[0] subdiv = comment.find('div') if subdiv is not None: # a subdiv which contains changes is found, move the tail text # of this div to comment text, and remove it. comment.text = (comment.text or '') + (subdiv.tail or '') - comment.remove(comment.find('div')) + comment.remove(comment.find('div')) update['message'] = self.parser.tostring(comment).strip() else: update['message'] = None