Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for numeric map keys #269

Closed
wants to merge 1 commit into from

Conversation

Richtermeister
Copy link

I have data from an external source which contains map[string]interface{} instances with numeric keys:

map[string]interface{}{
  "0": "foo",
  "1": "bar",
}

I'm trying to access this map via this template {{ mydict.0 }} as I would a regular map, but Pongo2 doesn't seem to allow this:

Can't access an index on type map (variable mydict.0)

This PR adds this capability.

@sonarcloud
Copy link

sonarcloud bot commented Jul 30, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Richtermeister
Copy link
Author

Richtermeister commented Dec 10, 2021 via email

@Richtermeister
Copy link
Author

@flosch Sorry to bother, could I please get some feedback on this PR? It seems straight-forward and has test coverage. If there's anything else I can do to unblock this, please let me know. Thank you for your time.

@flosch
Copy link
Owner

flosch commented Jun 24, 2022

Hi, this should be resolved by the introduced subscript syntax (#281): mydict["0"]

If not, feel free to re-open/answer again. Thanks!

@flosch flosch closed this Jun 24, 2022
@Richtermeister
Copy link
Author

Yes that looks good, I'll give that a shot! Thank you for your efforts on this library, I really appreciate it.

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.

None yet

2 participants