Skip to content

Commit 2c3501e

Browse files
committed
Fixes to debug helper ValidatedEmail.as_constructor
1 parent 786defc commit 2c3501e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

email_validator/exceptions_types.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __getattr__(self, key):
7676
return self.original
7777
if key == "email":
7878
return self.normalized
79-
raise AttributeError()
79+
raise AttributeError(key)
8080

8181
@property
8282
def email(self):
@@ -129,9 +129,10 @@ def as_constructor(self):
129129
+ ",".join("\n {}={}".format(
130130
key,
131131
repr(getattr(self, key)))
132-
for key in ('email', 'local_part', 'domain',
132+
for key in ('normalized', 'local_part', 'domain',
133133
'ascii_email', 'ascii_local_part', 'ascii_domain',
134134
'smtputf8', 'mx', 'mx_fallback_type')
135+
if hasattr(self, key)
135136
) \
136137
+ ")"
137138

0 commit comments

Comments
 (0)