-1
I’m getting some errors from Proto-C when I try to use endpoints.
My code:
class Application(EndpointsModel):
_message_fields_schema = ('id', 'nome')
criado = ndb.DateTimeProperty(auto_now_add=True)
nome = ndb.StringProperty()
regras = ndb.IntegerProperty(repeated=True)
atualizado = ndb.DateTimeProperty(auto_now=True)
dono = ndb.KeyProperty(kind='User')
@API.api_class(resource_nome="application")
class ApplicationApi(protorpc.remote.Service):
@Application.method(http_method="GET", request_fields=('id',), name="get", path="app/{id}")
def ApplicationGet(self, instance):
if not instance.from_datastore:
raise endpoints.NotFoundException("nao encontrado.")
return instance
@Application.query_method(http_method="GET", query_fields=('limite', 'ordem', 'token'), nome="lista", path="app")
def ApplicationList(self, query):
return query
When I call application.get(), error
ERROR 2018-07-04 09:30:16,199 test.py:366] Encountered unexpected error from ProtoRPC method implementation: TypeError (Can only copy from entities of the exact type Application. Received an instance of Application.)
What could be causing this?