Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Fixes for new app engine release (import endpoints and ResourceContainer) #80

Merged
merged 6 commits into from
Oct 19, 2013

Conversation

Scarygami
Copy link
Contributor

  1. I changed all references of google.appengine.ext.endpoints to the new endpoints library. Also updated the examples accordingly.
  2. First attempts at implementing ResourceContainer.

For query_method I create a ResourceContainer with message_types.VoidMessage as request body
and using the provided query_fields

For normal methods I check for path parameters and if they exist create a ResourceContainer using the
Model 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

Change all imports of the endpoints library
Change app.yaml to include library in examples
@dhermes
Copy link
Contributor

dhermes commented Oct 16, 2013

@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
Copy link

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)
@Scarygami
Copy link
Contributor Author

@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')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 'Container'?

Copy link
Contributor Author

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.

Copy link

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.

dhermes added a commit that referenced this pull request Oct 19, 2013
Fixes for new app engine release (import endpoints and ResourceContainer)
@dhermes dhermes merged commit c54c271 into GoogleCloudPlatform:master Oct 19, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update method and query_method to pass endpoints.ResourceContainer rather than Message
3 participants