You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to access the current request (in particular the extensions field) from within the template helpers I registered. The end goal is to make url_for from iron-router available in templates.
I realize that this is extremely hard and I'm not sure if handlebars-iron is even supposed to solve it. Flask solves the general problem by adding threadlocals everywhere, but I don't think that's the way to go for a framework and language where performance, control and data flow is more explicit than elsewhere.
The text was updated successfully, but these errors were encountered:
Well, the Context object is design to pass data to templates. So I think you can put the request data into context can access it from helper. To make it elegant perhaps we can design an Iron middleware to put some Request data into context.
Would there be a possibility to throw arbitrary types onto Context as well, in
the style of request.extensions? Right now I would need to serialize
data to JSON and back.
Probably would only be usable from helper functions, not directly from the
template.
On Sun, Sep 18, 2016 at 08:24:58AM -0700, Ning Sun wrote:
Well, the Context object is design to pass data to templates. So I think you can put the request data into context can access it from helper. To make it elegant perhaps we can design an Iron middleware to put some Request data into context.
I want to be able to access the current request (in particular the extensions field) from within the template helpers I registered. The end goal is to make
url_for
fromiron-router
available in templates.I realize that this is extremely hard and I'm not sure if handlebars-iron is even supposed to solve it. Flask solves the general problem by adding threadlocals everywhere, but I don't think that's the way to go for a framework and language where performance, control and data flow is more explicit than elsewhere.
The text was updated successfully, but these errors were encountered: