I'm getting some weird errors from protorpc
when I use endpoints. In this code:
class Application(EndpointsModel):
_message_fields_schema = ('id', 'name')
created = ndb.DateTimeProperty(auto_now_add=True)
name = ndb.StringProperty()
roles = ndb.IntegerProperty(repeated=True)
updated = ndb.DateTimeProperty(auto_now=True)
owner = ndb.KeyProperty(kind='User')
@API.api_class(resource_name="application")
class ApplicationApi(protorpc.remote.Service):
@Application.method(http_method="GET",
request_fields=('id',),
name="get",
path="applications/{id}")
def ApplicationGet(self, instance):
if not instance.from_datastore:
raise endpoints.NotFoundException("Application not found.")
return instance
@Application.query_method(http_method="GET",
query_fields=('limit', 'order', 'pageToken'),
name="list",
path="applications")
def ApplicationList(self, query):
return query
when I call application.get()
error is as follows: (full trace here):
TypeError: Can only copy from entities of the exact type Application. Received an instance of Application.
and for calling application.list()
error is as follows: (full trace here):
ValidationError: Expected type
<class '.Application'>
for field items, found<Application name: u'test'>
(type<class '.Application'>
)
What could be causing this? My other models with pretty much the same code (just different properties) work fine.
Subclass
class JsonModel(EndpointsModel)
to make it start working again.