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'`
我已經加入permission進資料庫了,為什麼程式還是提示這個問題?有沒有已經完成flasky這個計畫的前輩。指導一下唄,謝謝
self.role為None,flasky完整專案https://github.com/miguelgrin...可以參考