support new versions of redmine
This commit is contained in:
parent
536bc13347
commit
ec0cd3aa66
3 changed files with 52 additions and 27 deletions
|
|
@ -23,9 +23,9 @@ from weboob.tools.browser import BasePage
|
|||
|
||||
class LoginPage(BasePage):
|
||||
def login(self, username, password):
|
||||
self.browser.select_form(nr=1)
|
||||
self.browser['username'] = username
|
||||
self.browser['password'] = password
|
||||
self.browser.select_form(predicate=lambda f: f.attrs.get('method', '') == 'post')
|
||||
self.browser['username'] = username.encode(self.browser.ENCODING)
|
||||
self.browser['password'] = password.encode(self.browser.ENCODING)
|
||||
self.browser.submit()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,10 @@ class BaseIssuePage(BasePage):
|
|||
try:
|
||||
select = self.parser.select(self.document.getroot(), 'select#%s' % name, 1)
|
||||
except BrokenPageError:
|
||||
return
|
||||
try:
|
||||
select = self.parser.select(self.document.getroot(), 'select#%s_1' % name, 1)
|
||||
except BrokenPageError:
|
||||
return
|
||||
for option in select.findall('option'):
|
||||
if option.attrib['value'].isdigit():
|
||||
yield (option.attrib['value'], option.text)
|
||||
|
|
@ -95,6 +98,9 @@ class IssuesPage(BaseIssuePage):
|
|||
'statuses': 'values_status_id',
|
||||
}
|
||||
|
||||
def get_query_method(self):
|
||||
return self.document.xpath('//form[@id="query_form"]')[0].attrib['method'].upper()
|
||||
|
||||
def iter_issues(self):
|
||||
try:
|
||||
issues = self.parser.select(self.document.getroot(), 'table.issues', 1)
|
||||
|
|
@ -268,9 +274,9 @@ class IssuePage(NewIssuePage):
|
|||
params['updates'] = []
|
||||
for div in self.parser.select(content, 'div.journal'):
|
||||
update = {}
|
||||
update['id'] = div.find('h4').find('div').find('a').text[1:]
|
||||
alist = div.find('h4').findall('a')
|
||||
if len(alist) == 3:
|
||||
alist = div.find('h4').xpath('.//a')
|
||||
update['id'] = alist[0].text[1:]
|
||||
if len(alist) == 4:
|
||||
update['author'] = (int(alist[-2].attrib['href'].split('/')[-1]),
|
||||
to_unicode(alist[-2].text))
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue