Skip to content
This repository has been archived by the owner on Apr 15, 2018. It is now read-only.

Commit

Permalink
prepare for NonAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed May 18, 2013
1 parent fcb6b59 commit 97a5a8e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion june/forms/account.py
Expand Up @@ -21,7 +21,7 @@
RESERVED_WORDS = [
'root', 'admin', 'bot', 'robot', 'master', 'webmaster',
'account', 'people', 'user', 'users', 'project', 'projects',
'search', 'action', 'favorite', 'like', 'love',
'search', 'action', 'favorite', 'like', 'love', 'none',
'team', 'teams', 'group', 'groups', 'organization',
'organizations', 'package', 'packages', 'org', 'com', 'net',
'help', 'doc', 'docs', 'document', 'documentation', 'blog',
Expand Down
18 changes: 17 additions & 1 deletion june/models/account.py
Expand Up @@ -5,7 +5,7 @@
from werkzeug import security
from ._base import db, JuneQuery, SessionMixin

__all__ = ['Account']
__all__ = ['Account', 'NonAccount']


class Account(db.Model, SessionMixin):
Expand Down Expand Up @@ -84,3 +84,19 @@ def change_password(self, raw):
self.password = self.create_password(raw)
self.token = self.create_token()
return self


class NonAccount(object):
"""Non Account is a model designed for the deleted account.
Since the account is deleted, the topics and replies will has no
account related to them, in such cases, a `NonAccount` is used."""

username = 'none'
is_staff = False
is_admin = False

def __str__(self):
return 'none'

def __repr__(self):
return '<NonAccount: none>' % self.username

0 comments on commit 97a5a8e

Please sign in to comment.