Commit 85c4e887 authored by Célande Adrien's avatar Célande Adrien Committed by Romain Bignon

[caissedepargne] '-' corner case for recipient

People may have a '-' in their name.
So now the strign is splitted instead of just excluding '-' with a regex.

Closes: 16506@sibi
Closes: 16507@sibi
Closes: 16393@sibi
Closes: 12916@sibi
parent 5dc6a646
......@@ -883,12 +883,15 @@ class MyRecipients(ListElement):
self.env['label'] = mtc.group('label')
# Fcking corner case
else:
mtc = re.match('(?P<id>.+) - (?P<label>[^-]+) -( [^-]*)?-?$', CleanText('.')(self))
assert mtc
self.env['id'] = mtc.group('id')
# former regex: '(?P<id>.+) - (?P<label>[^-]+) -( [^-]*)?-?$'
# the strip is in case the string ends by ' -'
mtc = CleanText('.')(self).strip(' -').split(' - ')
# it needs to contain, at least, the id and the label
assert len(mtc) >= 2
self.env['id'] = mtc[0]
self.env['iban'] = NotAvailable
self.env['bank_name'] = NotAvailable
self.env['label'] = mtc.group('label')
self.env['label'] = mtc[1]
class TransferPage(TransferErrorPage, IndexPage):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment