@@ -93,9 +93,11 @@ def _post(self, res):
9393 def parse (self , line ):
9494 if line [- 1 ] == "\n " :
9595 line = line [:- 1 ]
96+ if len (line ) > self .size and len (line .strip ()) <= self .size :
97+ line = line [:self .size ]
9698 if len (line ) != self .size :
97- raise ParsingError ("Invalid line: %s . the len should be %s"
98- "instead of %s" % self .size , len (line ))
99+ raise ParsingError ("Invalid line: >%s< . the len should be %s"
100+ "instead of %s" % ( line , self .size , len (line ) ))
99101 match = self .re .match (line )
100102 # re check
101103 if match is None :
@@ -183,7 +185,7 @@ class ParserContent05(Parser):
183185 _regex = [
184186 ('record_code' , '(05)' , 2 ),
185187 ('bank_code' , G_N , 5 ),
186- ('internal_code' , G_AN , 4 ),
188+ ('internal_code' , G_AN_ , 4 ),
187189 ('desk_code' , G_N , 5 ),
188190 ('currency_code' , G_A_ , 3 ),
189191 ('nb_of_dec' , G_N_ , 1 ),
@@ -401,23 +403,20 @@ class ParserPDO(Parser):
401403 ]
402404
403405
404-
405406#specific to withdrawal
406- # TODO FIXME it's look like there is something wrong in
407- # confb norme indeed 35+4 != 70 and 35 != 70 :S outch!
408- #class ParserRUM(Parser):
409- # _code = 'RUM'
410- # _regex = [
411- # ('mandate_identification', G_ALL %35),
412- # ('sequence_type', G_ALL %4),
413- # ]
414- #
415- #class ParserCPY(Parser):
416- # _code = 'CPY'
417- # _regex = [
418- # ('debtor_account', G_ALL %35),
419- # ]
420- #
407+ class ParserRUM (Parser ):
408+ _code = 'RUM'
409+ _regex = [
410+ ('mandate_identification' , G_ALL , 35 ),
411+ ('sequence_type' , G_ALL , 4 ),
412+ ]
413+
414+ class ParserCPY (Parser ):
415+ _code = 'CPY'
416+ _regex = [
417+ ('debtor_account' , G_ALL , 35 ),
418+ ]
419+
421420
422421def parse_amount (amount_str , nb_of_dec ):
423422 """ return a numerical amount from the cfonb amount string
0 commit comments