Replace banknumber with python-stdnum

Since version 1.5 python-stdnum is capable of validating spanish account
numbers, so we should use the more generic library.
This commit is contained in:
Sergi Almacellas Abellana 2016-11-14 10:20:43 +01:00
parent 9950e33c9d
commit ffae0bc2ce
3 changed files with 7 additions and 4 deletions

View file

@ -1,3 +1,5 @@
* Replace banknumber with python-stdnum
Version 0.22 - 2016-09-06
* Manage None values on fields

View file

@ -29,7 +29,8 @@ except ImportError:
from decimal import Decimal
import re
from datetime import datetime
import banknumber
from stdnum.es.ccc import is_valid
from .formatting import format_string, format_number
from .exception import RetrofixException
@ -108,7 +109,7 @@ class Account(Char):
def set_from_file(self, value):
account = value.strip()
if account and not banknumber.check_code('ES', account):
if account and not is_valid(account):
raise RetrofixException('Invalid bank account "%s" in field "%s"'
% (value, self._name))
return super(Account, self).set_from_file(value)
@ -117,7 +118,7 @@ class Account(Char):
account = value
if account:
account = account.strip()
if account and not banknumber.check_code('ES', account):
if account and not is_valid(account):
raise RetrofixException('Invalid bank account "%s" in field "%s"'
% (value, self._name))
return super(Account, self).set(value)

View file

@ -56,7 +56,7 @@ setup(name=PACKAGE,
],
license=LICENSE,
install_requires=[
'banknumber >= 1.0',
'python-stdnum >= 1.5',
],
extras_require={},
zip_safe=False,