diff options
Diffstat (limited to 'pyaggr3g470r/models.py')
-rw-r--r-- | pyaggr3g470r/models.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py index 6c6df180..dcbe221c 100644 --- a/pyaggr3g470r/models.py +++ b/pyaggr3g470r/models.py @@ -26,6 +26,7 @@ __revision__ = "$Date: 2014/04/12 $" __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "GPLv3" +import re import json from datetime import datetime from sqlalchemy import asc, desc @@ -48,6 +49,10 @@ class User(db.Model, UserMixin): last_seen = db.Column(db.DateTime(), default=datetime.now) feeds = db.relationship('Feed', backref = 'subscriber', lazy = 'dynamic', cascade='all,delete-orphan') + @staticmethod + def make_valid_nickname(nickname): + return re.sub('[^a-zA-Z0-9_\.\-]', '', nickname) + def get_id(self): """ Return the id (email) of the user. |