Skip to content

Commit

Permalink
model: avoid setting value on getter
Browse files Browse the repository at this point in the history
  • Loading branch information
jrcastro2 committed Nov 9, 2023
1 parent 05657e0 commit d563afe
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions invenio_accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class User(db.Model, Timestamp, UserMixin):
_displayname = db.Column("displayname", db.String(255), nullable=True)
"""Case-preserving version of the username."""

_email = db.Column("email", db.String(255), unique=True)
email = db.Column(db.String(255), unique=True)
"""User email."""

password = db.Column(db.String(255))
Expand Down Expand Up @@ -203,16 +203,6 @@ def username(self, username):
self._displayname = username
self._username = username.lower()

@hybrid_property
def email(self):
"""Get email."""
return self._email

@email.setter
def email(self, email):
"""Set lowercase email."""
self._email = email.lower()

@hybrid_property
def user_profile(self):
"""Get the user profile."""
Expand All @@ -239,7 +229,7 @@ def preferences(self):
if self._preferences is None:
return None
elif not isinstance(self._preferences, UserPreferenceDict):
self._preferences = UserPreferenceDict(**self._preferences)
return UserPreferenceDict(**self._preferences)

return self._preferences

Expand Down

0 comments on commit d563afe

Please sign in to comment.