-
-
Notifications
You must be signed in to change notification settings - Fork 270
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
Struct's method calling not working #8
Comments
Have you tried it with the latest master? I tried your example code and pongo2 panics with the following (correct) error:
All functions called by pongo2 must be of type
The result is the following:
Hope this helps. |
Just to clarfiy: You can return whatever type you want through The A working example from the tests: https://github.com/flosch/pongo2/blob/master/pongo2_template_test.go#L34 |
Thak you. It did help. Now my only issue is to figure out a way to keep my code dry as I need to use For now I'm gonna wrap |
I'll keep that in mind and think about that. Maybe I can make pongo2 more flexible in calling such functions. Update: I created issue #9 for that. |
BTW, you can use
you can simply call But I understand that will only be a workaround for you. |
I pushed two commits to allow arbitrary function argument types and return types. Does this work for you? |
I'm gonna test it right now. |
Worked like a charm! Thak you a lot! |
You're welcome! |
When we have to print the result of a strutc's method it doesn't show anything.
Ex.:
What I could figure out is that when parsing Pongo2 knows that a function should be called, but when resolving, the function is not called and only the struct's properties is printed.
The text was updated successfully, but these errors were encountered: