我们的设施票据请求系统已经存在,但现在我们想要编辑与请求实体类型相关联的属性(requesttype)。当我改变这一行时:
requesttype = db.StringProperty(verbose_name="Request Type*",choices=(["Bulky Item Disposal","Carpentry","Ceiling,Doors","Electrical","Elevator","Fire Equipment","Groundskeeping","Hazardous Waste","HVAC","Kitchen Equipment","Lighting,Painting","Plumbing","Recycling","Refrigeration","Too Cold","Too Hot","Trash","Vehicle Maintenance","Water Leak","Windows","Other"]))
到
requesttype = db.StringProperty(verbose_name="Request Type*",choices=(["Bulky Item Disposal","Carpentry","Ceiling","Doors","Electrical","Elevator","Fire Equipment","Groundskeeping","Hazardous Waste","HVAC","Kitchen Equipment","Lighting","Locksmith","Painting","Plumbing","Recycling","Refrigeration","Too Cold","Too Hot","Trash","Vehicle Maintenance","Water Leak","Windows","Other"]))
我在日志中遇到以下错误;
Property requesttype is u'Ceiling,Doors'; must be one of ['Bulky Item Disposal', 'Carpentry', 'Ceiling', 'Doors', 'Electrical', 'Elevator', 'Fire Equipment', 'Groundskeeping', 'Hazardous Waste', 'HVAC', 'Kitchen Equipment', 'Lighting', 'Locksmith', 'Painting', 'Plumbing', 'Recycling', 'Refrigeration', 'Too Cold', 'Too Hot', 'Trash', 'Vehicle Maintenance', 'Water Leak', 'Windows', 'Other']
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~mma-facreq/6.372062129927600214/main.py", line 158, in get
self.response.out.write(template.render(template_values))
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py", line 894, in render
return self.environment.handle_exception(exc_info, True)
File "/base/data/home/apps/s~mma-facreq/6.372062129927600214/html/manage.html", line 1, in top-level template code
{% extends "html/base.html" %}
File "/base/data/home/apps/s~mma-facreq/6.372062129927600214/html/base.html", line 41, in top-level template code
{% block content %}{% endblock %}
File "/base/data/home/apps/s~mma-facreq/6.372062129927600214/html/manage.html", line 14, in block "content"
{% for x in reqs %}
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 2326, in next
return self.__model_class.from_entity(self.__iterator.next())
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 1438, in from_entity
return cls(None, _from_entity=entity, **entity_values)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 970, in __init__
prop.__set__(self, value)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 614, in __set__
value = self.validate(value)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 2841, in validate
value = super(StringProperty, self).validate(value)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 646, in validate
(self.name, value, self.choices))
BadValueError: Property requesttype is u'Ceiling,Doors'; must be one of ['Bulky Item Disposal', 'Carpentry', 'Ceiling', 'Doors', 'Electrical', 'Elevator', 'Fire Equipment', 'Groundskeeping', 'Hazardous Waste', 'HVAC', 'Kitchen Equipment', 'Lighting', 'Locksmith', 'Painting', 'Plumbing', 'Recycling', 'Refrigeration', 'Too Cold', 'Too Hot', 'Trash', 'Vehicle Maintenance', 'Water Leak', 'Windows', 'Other']
答案 0 :(得分:2)
看起来您的原始代码中有拼写错误,用它来保存一些数据存储条目,然后更新代码以修复它。
现在,您必须在数据存储区中包含一些条目,其中包含“Ceiling,Doors”作为请求类型。当它们被提取时,它们会导致错误,因为这不再是合法的请求类型。
要解决此问题,您基本上需要在选项中添加“Ceiling,Doors”,“Ceiling”,“Doors”,然后将数据存储区中具有“Ceiling,Doors”的所有实体更新为相应的,值。完成后,您可以删除“Ceiling,Doors”作为选择。