def register(cls, name, pw, email=None): ''' takes all user information, makes a pw hash, then creates a new user instance with the hashed pw ''' pw_hash = make_pw_hash(name, pw) return User(parent=users_key(), username=name, pw_hash=pw_hash, email=email)
def by_id(cls, uid): ''' retrieves a user instance from the db using the cookie's user-id value ''' return User.get_by_id(uid, parent=users_key())