Skip to content

Support mappings that are not simply dicts.#144

Open
martinpengellyphillips wants to merge 3 commits into
defunkt:masterfrom
martinpengellyphillips:support_mappings_that_are_not_dicts
Open

Support mappings that are not simply dicts.#144
martinpengellyphillips wants to merge 3 commits into
defunkt:masterfrom
martinpengellyphillips:support_mappings_that_are_not_dicts

Conversation

@martinpengellyphillips

Copy link
Copy Markdown

As part of a recent project I needed Pystache to work with a custom class that followed the collections.Mapping spec and was not directly subclassed from dict. As a result, Pystache wouldn't retrieve items from the mapping. This patch fixes the context to test type against collections.Mapping rather than dict.

@cjerdonek

Copy link
Copy Markdown
Collaborator

Thanks for the suggestion and patch. Can you add a test, too? It would also be good to add a code comment to explain why collections.Mapping is used instead of dict (and perhaps referencing this issue number).

@martinpengellyphillips

Copy link
Copy Markdown
Author

Will do.

@martinpengellyphillips

Copy link
Copy Markdown
Author

Added docs and unit tests. Let me know if anything else is needed?

@ludovicchabant

Copy link
Copy Markdown

Hey @cjerdonek, you asked what issue people would want fixed in a new release and for me this is the one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants