question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EmailProperty seems to be required

See original GitHub issue

Despite email_distribution = EmailProperty(required=False,... the validation for Email Property seems to be required.

For example, when I try to submit a blank email field I get this back: '' does not matches '[^@]+@[^@]+\\.[^@]+'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
StevenMapescommented, Oct 4, 2018

This is not a bug but is you misunderstanding what the required=False attribute means.

By setting the property as optional i.e. required=False you are saying that you do not need to set the property at all or you can set it to None. Setting it to an empty string is not the same as None as it has a value (an empy string) and thus it does not match the regex.

Here is an example of a simple class which I will try to save three instances of, one that will fail as it has an invalid email of an empty string and then the 2nd which will show the correct way of using the object without assigning the email and then the third which will show the alternative method where I’ll set email=None

from neomodel import StructuredNode, StringProperty, EmailProperty

class SteveTest(StructuredNode):
    email=EmailProperty(required=False)
    name=StringProperty(required=True)

s = SteveTest(name="Should Fail", email="")
s.save()
# ValueError: '' does not matches '[^@]+@[^@]+\\.[^@]+'

# Don't set the property
s = SteveTest(name="Will work")
s.save()
# <SteveTest: {'email': None, 'name': 'Should Fail', 'id': 1}>

# Set the property to None
s1 = SteveTest(name="Or you can do this", email=None)
s1.save()
# <SteveTest: {'email': None, 'name': 'Should Fail', 'id': 2}>
0reactions
aanastasioucommented, Apr 25, 2019

@HashRocketSyntax Thank you, this has now been highlighted in the documentation and will be rolled out in an upcoming release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change work email property using Online powershell
I have done some research and it seems this is not feasible. For the cmdlet Set-SPOuser is to configure properties of an existing...
Read more >
What is the type of error when authenticating with Google ...
I'm using typescript, I'm accessing err.email as shown in their docs. but it seems that there is not email property in the error, ......
Read more >
Anybody can help me with IMAP configuration in mule 4? I am ...
IMAP with outlook.office365.com works fine utilizing the beneath property in the connector properties configuration. <email:property key="mail.
Read more >
Can't retrieve email property in access token despite being ...
My issue is likely due to confusion between access and ID token. When I use the universal login, I appear to get all...
Read more >
Property types — neomodel 4.0.8 documentation
Setting required=True makes the property mandatory. ... uid = UniqueIdProperty() full_name = StringProperty(required = True) email = EmailProperty().
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found