python - project permission issues
天蓬老师
天蓬老师 2017-06-12 09:24:08
0
1
634

AttributeError: 'NoneType' object has no attribute 'permission'
-------------------------------- ----------------------------------`
{% if current_user.can(Permission.MODERATE_COMMENTS) %}

File "/home/centos/Desktop/workspace/flasky_163/app/models.py", line 207, in can def generate_email_change_token(self, new_email, expiration=3600): s = Serializer(current_app.config['SECRET_KEY'], expiration) return s.dumps({'change_email': self.id, 'new_email': new_email}) def can(self, permission): return (self.role.permission & permission) == permission def is_administrator(self): return self.can(Permission.ADMINISTER) def ping(self): AttributeError: 'NoneType' object has no attribute 'permission'`

I have added permission into the database, why does the program still prompt this question? Is there anyone who has completed the flasky project? Please give me some guidance, thank you

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all (1)
某草草

self.role is None, flasky complete project https://github.com/miguelgrin... can be referred to

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!