Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
weboob
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
183
Issues
183
List
Boards
Labels
Milestones
Merge Requests
52
Merge Requests
52
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
weboob
weboob
Commits
215692d3
Commit
215692d3
authored
Feb 02, 2021
by
Florent Viard
Committed by
Vincent A
Feb 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[bp] Use Lower and Upper Filters when possible
parent
cf65d800
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
modules/bp/pages/accountlist.py
modules/bp/pages/accountlist.py
+10
-10
No files found.
modules/bp/pages/accountlist.py
View file @
215692d3
...
...
@@ -33,7 +33,7 @@
from
weboob.browser.filters.html
import
Link
,
TableCell
,
Attr
from
weboob.browser.filters.standard
import
(
CleanText
,
CleanDecimal
,
Regexp
,
Env
,
Field
,
Currency
,
Async
,
Date
,
Format
,
Coalesce
,
Async
,
Date
,
Format
,
Coalesce
,
Lower
,
Upper
,
)
from
weboob.exceptions
import
BrowserUnavailable
from
weboob.tools.compat
import
urljoin
,
unicode
...
...
@@ -100,10 +100,10 @@ def obj_url(self):
return
url
def
obj_label
(
self
):
return
CleanText
(
'.//div[@class="title"]/h3'
)(
self
)
.
upper
(
)
return
Upper
(
'.//div[@class="title"]/h3'
)(
self
)
def
obj_ownership
(
self
):
account_holder
=
CleanText
(
'.//div[@class="title"]/span'
)(
self
)
.
lower
(
)
account_holder
=
Lower
(
'.//div[@class="title"]/span'
)(
self
)
pattern
=
re
.
compile
(
r'(m|mr|me|mme|mlle|mle|ml)\.? (.*)\bou ?(m|mr|me|mme|mlle|mle|ml)?\b(.*)'
,
re
.
IGNORECASE
...
...
@@ -226,13 +226,13 @@ def obj_type(self):
}
# first trying to match with label
label
=
CleanText
(
Field
(
'label'
),
transliterate
=
True
)(
self
)
label
=
Lower
(
Field
(
'label'
),
transliterate
=
True
)(
self
)
for
atypetxt
,
atype
in
types
.
items
():
if
re
.
findall
(
atypetxt
,
label
.
lower
()
):
# match with/without plural in type
if
re
.
findall
(
atypetxt
,
label
):
# match with/without plural in type
return
atype
# then by type (not on the loans page)
type_
=
Regexp
(
CleanText
(
Lower
(
'./ancestor::ul/preceding-sibling::div[@class="assets" or @class="avoirs"][1]//span[1]'
,
transliterate
=
True
,
),
...
...
@@ -242,7 +242,7 @@ def obj_type(self):
)(
self
)
if
type_
:
for
atypetxt
,
atype
in
types
.
items
():
if
re
.
findall
(
atypetxt
,
type_
.
lower
()
):
# match with/without plural in type
if
re
.
findall
(
atypetxt
,
type_
):
# match with/without plural in type
return
atype
return
Account
.
TYPE_UNKNOWN
...
...
@@ -391,11 +391,11 @@ def obj_id(self):
def
obj_label
(
self
):
cell
=
TableCell
(
'label'
,
default
=
None
)(
self
)
if
cell
:
return
CleanText
(
cell
,
default
=
NotAvailable
)(
self
)
.
upper
(
)
return
Upper
(
cell
,
default
=
NotAvailable
)(
self
)
return
CleanText
(
return
Upper
(
'//form[contains(@action, "detaillerOffre") or contains(@action, "detaillerPretPartenaireListe-encoursPrets.ea")]/div[@class="bloc Tmargin"]/h2[@class="title-level2"]'
)(
self
)
.
upper
()
)(
self
)
def
obj_balance
(
self
):
if
CleanText
(
TableCell
(
'balance'
))(
self
)
!=
u'Remboursé intégralement'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment