-
Notifications
You must be signed in to change notification settings - Fork 47
Description
I'm currently experimenting with using the Grantlee_Templates library as a replacement for the (very) basic templating language that the Shibboleth SP project provides to render HTML error report pages:
https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPErrors
It's working well so far, but the issue that I'm running into is that the templating API of the Shibboleth SP project uses dynamic variable lookup, i.e. there is a TemplateParameters class with a getParameter(const char* varName) method that gets invoked at runtime to look up the desired variable from a set of different possible sources in a well-defined order.
In my replacement POC I have access to such a TemplateParameters instance, but I can't "plug it in" to the Grantlee templating system because Context::lookup is declared as non-virtual, so I have no chance of modifying how variables are looked up at runtime. If instead it were declared virtual, I could create a subclass of Context that dispatches runtime lookup of variables to the TemplateParameters instance (though only after first failing the original Context::lookup --the ability for local variables to be pushed onto the stack at runtime by various tags like for and with must stay respected).
So my question is this: would you consider virtualizing Context::lookup and related others to allow end users to customize runtime variable lookup?