← Back to team overview

banking-addons-team team mailing list archive

Re: Italian IBAN format

 

On 02-05-12 01:19, James Jesudason wrote:


On Tuesday, 1 May 2012, Stefan Rijnhart wrote:

    On 30-04-12 21:13, Stefan Rijnhart wrote:


        I cannot find any published evidence that there exists such a
        thing as an IBAN without an ISO code. The horse's mouth states
        the contrary (from [1], page 11):


    James,

    replying to myself not to hasten you for a reaction but I figured
    the above is probably not what you are trying to say anyway.
    Although I do not encounter many Italian account numbers in real
    life, I tried with a number of Italian IBAN numbers that I found
    on Google, and the shorter form I suggested on the bug tracker
    does consistently solve the following exception upon account
    number validation:

    account_banking/sepa/iban.py", line 131, in __extract__
       result += value[i+4]
    IndexError: string index out of range



    If this is not the problem you encountered, could you please
    clarify further when you find the time.

Yes the error was something like that. I think you may have misunderstood my comment on the bug. The way that the parser is treating the Iban is converting IT0911111111... to something like I/T09111/1111... ie. it is treating the country code as part of the domestic account number (which is incorrect).


Hi James,

Yes, I misunderstood. Skipping the country code is what the 'i+4' is for in the line above. It crashes with the current code because the formatting string in the code is longer than the account numbers without the ISO code and checksum digits.

I am finding that the IBAN parsing is not very good in general - is there a standard Python library we could use instead? Looking at the comments in the code, it sounds as though it was written as a temporary solution.


Having a standard library would be nice. The only viable candidate seems to be http://pypi.python.org/pypi/python-stdnum. We should look into it after the 6.1 release, on which I am working now. I really would like to ship it with a working validation of Italian IBANs, but after applying the suggestion from the bug report I cannot reproduce the problem anymore. Would you be able to forward me the account number that demonstrates the problem privately?

Cheers,
Stefan.


--
Therp - Maatwerk in open ontwikkeling

Stefan Rijnhart - Ontwerp en implementatie

mail: stefan@xxxxxxxx
tel: +31 (0) 614478606
http://therp.nl
https://twitter.com/therp_stefan


References