Merge lp:~therp-nl/banking-addons/girotel_structured_description into lp:banking-addons/6.1

Proposed by Holger Brunn (Therp)
Status: Merged
Merged at revision: 177
Proposed branch: lp:~therp-nl/banking-addons/girotel_structured_description
Merge into: lp:banking-addons/6.1
Diff against target: 34 lines (+10/-0)
1 file modified
account_banking_nl_girotel/girotel.py (+10/-0)
To merge this branch: bzr merge lp:~therp-nl/banking-addons/girotel_structured_description
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review, no test Approve
Stefan Rijnhart (Opener) Approve
Review via email: mp+168453@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

lgtm

review: Approve
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_banking_nl_girotel/girotel.py'
2--- account_banking_nl_girotel/girotel.py 2012-07-09 17:04:14 +0000
3+++ account_banking_nl_girotel/girotel.py 2013-06-10 13:58:27 +0000
4@@ -46,6 +46,7 @@
5 from account_banking.parsers.convert import str2date, to_swift
6 from tools.translate import _
7 import csv
8+import re
9
10 bt = models.mem_bank_transaction
11
12@@ -143,6 +144,10 @@
13 'VZ': bt.PAYMENT_BATCH,
14 }
15
16+ structured_description_regex = re.compile(
17+ '^IBAN: (?P<iban>\w+) BIC: (?P<bic>\w+) Naam: (?P<name>.+) '
18+ 'Omschrijving: (?P<desc>.+)$')
19+
20 def __init__(self, line, *args, **kwargs):
21 '''
22 Initialize own dict with read values.
23@@ -274,6 +279,11 @@
24 # Normal transaction, but remote_owner can contain city, depending
25 # on length of total. As there is no clear pattern, leave it as
26 # is.
27+ structured_description = self.structured_description_regex.match(
28+ ''.join(self.message.split('\n')))
29+ if structured_description:
30+ values = structured_description.groupdict()
31+ self.reference = values['desc']
32 self.message = self.refold_message(self.message)
33
34 else:

Subscribers

People subscribed via source and target branches