많은 기존 인스턴스가있는 엔티티 모델에 목록 속성을 추가했습니다.BadValueError : 속성 X가 필요합니다.
응용 프로그램은 짧은 시간 동안 문제없이 실행되는 실제 환경에 배포 할시class MyModel(db.Model):
new_property = db.ListProperty(item_type=str, default=None)
다음은 데이터 저장소에서 레코드를 검색하려고으로 BadValueError 오류가 던지는 시작합니다.
app_item = db.get(app_item_key)
내가 1.7.5를 사용하고 있습니다 :
오류를 던지고 코드는 데이터 저장소에 바로 호출입니다. 파이썬 2.7 런타임.
내가 이것을 막기 위해 무엇을 할 수 있는지, 아니면 적어도 상점에서 데이터를 가져올 수 있도록 잡아 두겠다는 아이디어가 있습니까? 에 따라 그 사람들을 위해
Traceback (most recent call last):
File "/base/data/home/apps/app/4-15.365909351579418812/app.py", line 1739, in app_get
app_item = db.get(app_item_key)
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 1533, in get
return get_async(keys, **kwargs).get_result()
File "/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 604, in get_result
return self.__get_result_hook(self)
File "/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1459, in __get_hook
entities = rpc.user_data(entities)
File "/python27_runtime/python27_lib/versions/1/google/appengine/api/datastore.py", line 600, in local_extra_hook
return extra_hook(result)
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 1503, in extra_hook
model = cls1.from_entity(entity)
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 1438, in from_entity
return cls(None, _from_entity=entity, **entity_values)
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 970, in __init__
prop.__set__(self, value)
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 614, in __set__
value = self.validate(value)
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 3460, in validate
value = super(ListProperty, self).validate(value)
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 641, in validate
raise BadValueError('Property %s is required' % self.name)
BadValueError: Property new_property is required
:
new_property = db.ListProperty(item_type=str, default=None)
읽어야합니다 :
빈 목록에 기본 값을 변경을 아론 D의 제안에 따라 경찰은, 그래서이 문제를 해결
new_property = db.ListProperty(item_type=str, default=[])
검색 호출과 같은 관련성 높은 코드를 게시 할 수 있습니까? 그것이 http://stackoverflow.com/questions/6142439/badvalueerror-property-xxxx-is-required-even-after-the-xxxx-property-has-alrea?rq=1에 느슨하게 관련되어있는 것처럼 보입니다. –
이 대답은 관련이있을 수 있습니다 : http://stackoverflow.com/a/10012905/399704 –
두 경우 모두 이것들은 property와 관련된 required = true와 관련이 있습니다. 그러나 여기에는 해당되지 않습니다 (비록 그것이 그대로도 작동 함에도 불구하고) . – notreadbyhumans