support changes of issue content
This commit is contained in:
parent
f951f51b3d
commit
4a29a246a2
4 changed files with 32 additions and 3 deletions
|
|
@ -21,7 +21,9 @@
|
|||
from __future__ import with_statement
|
||||
|
||||
from weboob.capabilities.content import ICapContent, Content
|
||||
from weboob.capabilities.bugtracker import ICapBugTracker, Issue, Project, User, Version, Status, Update, Attachment, Query
|
||||
from weboob.capabilities.bugtracker import ICapBugTracker, Issue, Project, User, \
|
||||
Version, Status, Update, Attachment, \
|
||||
Query, Change
|
||||
from weboob.capabilities.collection import ICapCollection, Collection, CollectionNotFound
|
||||
from weboob.tools.backend import BaseBackend, BackendConfig
|
||||
from weboob.tools.browser import BrowserHTTPNotFound
|
||||
|
|
@ -186,6 +188,13 @@ class RedmineBackend(BaseBackend, ICapContent, ICapBugTracker, ICapCollection):
|
|||
update.author = issue.project.find_user(*u['author'])
|
||||
update.date = u['date']
|
||||
update.message = u['message']
|
||||
update.changes = []
|
||||
for i, (field, last, new) in enumerate(u['changes']):
|
||||
change = Change(i)
|
||||
change.field = field
|
||||
change.last = last
|
||||
change.new = new
|
||||
update.changes.append(change)
|
||||
issue.history.append(update)
|
||||
issue.author = issue.project.find_user(*params['author'])
|
||||
issue.assignee = issue.project.find_user(*params['assignee'])
|
||||
|
|
|
|||
|
|
@ -258,6 +258,17 @@ class IssuePage(NewIssuePage):
|
|||
else:
|
||||
update['message'] = None
|
||||
|
||||
changes = []
|
||||
for li in self.parser.select(div, 'ul.details', 1).findall('li'):
|
||||
field = li.find('strong').text.decode('utf-8')
|
||||
if len(li.findall('i')) == 2:
|
||||
last = li.findall('i')[0].text.decode('utf-8')
|
||||
else:
|
||||
last = None
|
||||
new = li.findall('i')[-1].text.decode('utf-8')
|
||||
changes.append((field, last, new))
|
||||
update['changes'] = changes
|
||||
|
||||
params['updates'].append(update)
|
||||
|
||||
return params
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue