akretion / python-cfonb

Python librairy for reading/writing document enforcing the CFONB norm
GNU Lesser General Public License v3.0
2 stars 16 forks source link

Impossible to parse the CFONB file of some banks #1

Closed pinaraf closed 10 years ago

pinaraf commented 10 years ago

The statement files from HSBC can not be parsed, an error occur during the parsing of 05 records…

pinaraf commented 10 years ago

Here is a very simple patch, written after checking the CFONB specification :

diff --git a/cfonb/parser/common.py b/cfonb/parser/common.py
index 22dc003..b9ef8f1 100644
--- a/cfonb/parser/common.py
+++ b/cfonb/parser/common.py
@@ -183,7 +183,7 @@ class ParserContent05(Parser):
     _regex = [
         ('record_code',     '(05)',  2),
         ('bank_code',       G_N,     5),
-        ('internal_code',   G_AN,    4),
+        ('internal_code',   G_AN_,   4),
         ('desk_code',       G_N,     5),
         ('currency_code',   G_A_,    3),
         ('nb_of_dec',       G_N_,    1),
pinaraf commented 10 years ago

Merged in pull request #2

sebastienbeau commented 10 years ago

I merge your fix