[openaddresses] fix Chinese house number validation
This commit is contained in:
@@ -150,7 +150,10 @@ class OpenAddressesFormatter(object):
|
||||
if not house_number:
|
||||
return False
|
||||
tokens = tokenize(house_number)
|
||||
return all((c in token_types.NUMERIC_TOKEN_TYPES or t in (u'号', u'栋', u'附')) for t, c in tokens)
|
||||
|
||||
if all((c in token_types.NUMERIC_TOKEN_TYPES or t in (u'号', u'栋', u'附')) for t, c in tokens):
|
||||
return True
|
||||
return cls.validate_house_number(house_number)
|
||||
|
||||
component_validators = {
|
||||
AddressFormatter.HOUSE_NUMBER: validators.validate_house_number,
|
||||
@@ -158,7 +161,6 @@ class OpenAddressesFormatter(object):
|
||||
AddressFormatter.POSTCODE: validators.validate_postcode,
|
||||
}
|
||||
|
||||
|
||||
language_validators = {
|
||||
SPANISH: {
|
||||
AddressFormatter.HOUSE_NUMBER: validators.validate_house_number_sin_numero,
|
||||
|
||||
Reference in New Issue
Block a user