-
Notifications
You must be signed in to change notification settings - Fork 52
Fixes for new app engine release (import endpoints and ResourceContainer) #80
Conversation
Change all imports of the endpoints library Change app.yaml to include library in examples
@kdeus Want to give it a look? |
def ResourceContainer(cls, message=message_types.VoidMessage, fields=None): | ||
"""Creates a ResourceContainer using a subset of the class properties. | ||
|
||
Creates a ResourceContainer using the provided message class as request body and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format all lines to be 80 characters or less. This helps readability, especially in the code below.
Moved message_fields creation to a separate method. Reformated to make lines shorter. Caching ResourceContainers (separate from proto models and collections)
@kdeus thanks for the comments, added a new commit with some fixes. |
fields = cls._message_fields_schema | ||
|
||
message_fields_schema = MessageFieldsSchema(fields, | ||
basename=cls.__name__ + 'Proto') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 'Container'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that. I had 'Container'
in there originally, but the fields inside of the Container are still ProtoRPC message fields, so keeping with 'Proto'
as for the other MessageFieldsSchema
seemed more logical.
I can change that to 'Container'
if you want though, doesn't make any difference really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, Proto is fine. It only came up because I noticed it'd changed from your previous commit, and I wasn't sure if that was intentional.
Fixes for new app engine release (import endpoints and ResourceContainer)
google.appengine.ext.endpoints
to the new endpoints library. Also updated the examples accordingly.ResourceContainer
.For
query_method
I create aResourceContainer
withmessage_types.VoidMessage
as request bodyand using the provided
query_fields
For normal methods I check for path parameters and if they exist create a
ResourceContainer
using theModel itself (respecting
request_fields
) as request body and adding the extracted path parameters.I've tested this with one of my more advanced Endpoint APIs and it works without problems and warnings.
Biggest problem I see is with Message Classes now all being
CombinedContainer
so checking against the cached proto_models won't work. Not sure if there is a good solution for that (or if the check is really necessary).This should fix #79