Introduce "EmailAddress" class #11
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: karolyi/py3-validate-email#11
Loading…
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This introduces a class that unifies the tasks of splitting email address into user and domain part as well as converting an international domain name into the ASCII-compatible encoding.
@karolyi I have tried to follow the general coding style of the project.
Please tell me if you see room for improvement.
As per PEP8, docstrings terminate at 72 columns.
can you please pull my latest changes on master?
I see you also removed tests for the email format checks.
Please add those back for testing your new class, the tests are a good quality indicator.
same here with the PEP8 stuff
Will add the test soon, must eat some cake first ;-)
I'm still fighting with the installer part (python package installers are a mess), so bare with me until I get to review your changes.
@karolyi No worries, I'm perfectly fine enjoying the Easter Sunday sun meanwhile :-)
P.S. all your comments on my changes are much appreciated, please don't hesitate to point me to any possible improvement!
@ -6,4 +6,3 @@
r'((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+)'
r'(?:[A-Z0-9-]{2,63}(?<!-))\Z', IGNORECASE)
EMAIL_EXTRACT_HOST_REGEX = re_compile(r'(?<=@)\[?([^\[\]]+)')
LITERAL_REGEX = re_compile(
I would keep this constant and use for dissecting email address user and domain parts, so the problem you mentioned in the other issue will be easier to address.
@ -58,2 +45,4 @@
ip_address = literal_match.group(1)
if _validate_ipv46_address(ip_address):
return True
What was the reason for removing RegexValidator? I don't see it, maybe you could explain?
python3 object
Looking good so far, other than the two things I asked/questioned.
If you change/explain those, a squash on the commits will be necessary, and then I think we'll be good to go.
@ -6,4 +6,3 @@
r'((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+)'
r'(?:[A-Z0-9-]{2,63}(?<!-))\Z', IGNORECASE)
EMAIL_EXTRACT_HOST_REGEX = re_compile(r'(?<=@)\[?([^\[\]]+)')
LITERAL_REGEX = re_compile(
If I am not mistaken, if an IP address is used as the domain part of an email address, it must be enclosed in brackets. So syntactically, user@[123.123.123.123] is a valid email address, while user@123.123.123.123 isn't (unless 123.123.123.123 can be considered a domain name). This regex removes the brackets, so we will later not be able to distinguish between these cases. I think it's better to just use the rsplit and keep the brackets.
@ -58,2 +45,4 @@
ip_address = literal_match.group(1)
if _validate_ipv46_address(ip_address):
return True
The reason was simply that the class has degenerated to containing only a call() method and nothing else, so it can be replaced by a plain function. Is there any reason to wrap this function into a class I didn't see?
I've posted my considerations on your questions. I totally agree on the squash commit :-)
Alright, LGTM.
Please squash your commit into one and I'll merge the PR and make a release.
Again, thank you for your contribution! Much appreciated.
Sorry @karolyi I think I need your help with squashing the commits into one. Can I do this within this pull request and with in this branch, or do I have to create a new branch and a new pull request?
P.S. I thought that squashing into one is something that you do when you apply the pull request, so I am somwhat lost here.
@karolyi please ignore my previous message, I managed to do it. Learned something new about git today :-)
I think you should be fine to pull now. Thank you for your cooperation in this!
BTW, I think it's not really necessary to make a release because of this change, because it doesn't add a new user-visisble feature.
Thank you!
I'll issue a release nevertheless, just to make sure everybody has your changes. If there's any problems with it, new issues will be posted.
Also, I have some smaller changes, that too should be released.