I need register a global filter to return userinfo from session. I resister a new filter.
pongo2.RegisterFilter("getSessions", getSession)
func getSession(in, param *pongo2.Value) (*pongo2.Value,*pongo2.Error) {
uInfo := lib.Sess.Get("userInfo")
if uInfo == nil {
lib.Logs.Error("get userinfo err from session")
} else {
}
return pongo2.AsValue(uInfo), nil
}
and in the html i use like this:
{{ "getsess" | getSessions}}
but it's not work, the result is empty. but if reutrn a string is work well . if i want to return a map or array . how to do it ?