# HG changeset patch # User Marcin Lulek # Date 2017-06-19 08:56:31 # Node ID a1111aae75c874264cf108b9d955c0b604ba65e1 # Parent 07e2beb08eb68a3105ff71b3106f965a841ccafb User: use new escaped hybrid properties for usage in code. - Allows introducing the safer method of reading first/last names from users. diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -572,6 +572,16 @@ class User(Base, BaseModel): self._email = val.lower() if val else None @hybrid_property + def first_name(self): + from rhodecode.lib import helpers as h + return h.escape(self.name) + + @hybrid_property + def last_name(self): + from rhodecode.lib import helpers as h + return h.escape(self.lastname) + + @hybrid_property def api_key(self): """ Fetch if exist an auth-token with role ALL connected to this user