Allow for arbitrary delimiters in DelimitedDigitsPostalCode validator.#125
Merged
lambacck merged 1 commit intoFeb 4, 2017
Merged
Conversation
Contributor
Author
|
FYI, tests fail due API changes introduced in the new series of pycountry, #124 resolves that :) |
Contributor
|
Needs merge from master to make tests pass. |
ec87055 to
37b41a8
Compare
Contributor
Author
|
All good now. |
Contributor
Author
|
Hi @lambacck, any chance you could merge this in and push a new (alpha?) release to PyPI? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As per the subject, this alters the
DelimitedDigitsPostalCodeclass to accept postal codes with arbitrary (wrong) delimiters in the input. The grouping and delimiter are used for output grouping, but the input is solely verified by its digit content.This behavior is at least already partially supported, where delimiters in input are optional, so this is an extension on that. The code still builds up a regex which is then verified against, but at this point it might make more sense to just use
re.findall()to get the digits and check for the correct count if thestrictparameter is provided.I'm happy to make changes if you like that approach better.