我有一个个人资料课程:
class profile(db.Model):
user = db.stringProperty()
# Other properties ...
access = db.ListProperty(db.keys)
class apps(db.Model):
name = db.StringProperty()
配置文件类在那里安静了一段时间,但我们最近添加了访问字段,它将存储应用程序的密钥。现在我们在应用程序上添加配置文件权限,访问字段不会在模型中更新。
这在本地主机上完全可以正常工作,但是当我在服务器上更新它时,我得到这个错误“'NoneType'对象没有属性'access'”有没有人遇到过同样的情况
更新: 发现配置文件类中的一个对象被返回为无。这是在本地主机上获取配置文件对象但在服务器上没有的代码
liuser = users.User(request.POST['user'])
#request.POST['user'] gets user Gmail ID, which is being converted to user object
profiles=Profile.all().filter(" user =", liuser).get()
userprofile=profiles
#tried below code which returns "'NoneType' object has no attribute 'access'" on server, the same gets a profile object on localhost
if not hasattr(userprofile, "access"):
userprofile.access=[]
@Robert希望格式现在很好。
谢谢你赛克里希纳