Update models.py

Wonder if it is better to  return a local variable  inside a while-loop?
This commit is contained in:
Sinux 2015-01-29 18:50:42 +08:00
parent 5e9cc831e8
commit d84000d381
1 changed files with 1 additions and 2 deletions

View File

@ -46,9 +46,8 @@ class User(db.Model):
while True: while True:
new_nickname = nickname + str(version) new_nickname = nickname + str(version)
if User.query.filter_by(nickname=new_nickname).first() is None: if User.query.filter_by(nickname=new_nickname).first() is None:
break return new_nickname
version += 1 version += 1
return new_nickname
def is_authenticated(self): def is_authenticated(self):
return True return True