端点Proto数据存储定制属性名称

时间:2014-09-29 22:44:20

标签: google-cloud-endpoints endpoints-proto-datastore

有没有办法使用定义自定义名称的属性创建EndpointsModel的子类?即:

    class ProfilesApi(remote.Service):
    @Profile.method(name='user', path='user')
      def details(self, profile):
        return profile

    class Profile(EndpointsModel):
      user_id = ndb.StringProperty('uid')

收到以下错误:

INFO     2014-09-30 15:54:10,066 module.py:652] default: "POST /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 200 3922
ERROR    2014-09-30 15:54:10,071 service.py:191] Encountered unexpected error from ProtoRPC method implementation: AttributeError ('Profile' object has no attribute 'uid')
Traceback (most recent call last):
  File ".../google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/wsgi/service.py", line 181, in protorpc_service_app
    response = method(instance, request)
  File ".../google-cloud-sdk/platform/google_appengine/lib/endpoints-1.0/endpoints/api_config.py", line 1329, in invoke_remote
    return remote_method(service_instance, request)
  File ".../google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/remote.py", line 412, in invoke_remote_method
    response = method(service_instance, request)
  File ".../default/endpoints_proto_datastore/ndb/model.py", line 1327, in EntityToRequestMethod
    response = response.ToMessage(fields=response_fields)
  File ".../default/endpoints_proto_datastore/ndb/model.py", line 1080, in ToMessage
    value = getattr(self, name)
AttributeError: 'Profile' object has no attribute 'uid'
INFO     2014-09-30 15:54:10,076 module.py:652] default: "POST /_ah/spi/ProfilesApi.details HTTP/1.1" 500 512
INFO     2014-09-30 15:54:10,077 module.py:652] default: "POST /_ah/api/my_project/v2/user HTTP/1.1" 503 196

问题似乎在endpoints_proto_datastore中,对吧?我想有一种特定的方法可以做到这一点。我还没有找到任何关于它的样本或文档。

0 个答案:

没有答案
相关问题