On Mon, 10 Feb 2014 10:18:04 +0100, Sönke Ludwig wrote:

Am 10.02.2014 09:42, schrieb Damian Ziemba:

On Mon, 10 Feb 2014 00:16:05 GMT, Etienne wrote:

You can capture HTTPServerRequest as a function parameter in your vibe.web.web callback function and it'll detect this and send the object, so you can consult the session or cookies from it. Personally I would think themes would belong in different CSS files, so you could definitely send the variable containing the theme name to your diet template to get the corresponding CSS without having to generate a different diet template.

I am aware of being able to capture HTTPServerRequest/HTTPServerResponse.
The thing is I don't want to pass additional arguments without a need. (Assuming I need only to render template, nothing else).
On longer run it becomes cumbersome.

void getSomething(HTTPServerRequest req, HTTPServerResponse res) { render!("something.dt")(req, res); }

vs

void getSomething() { render!("something.dt"); }

Well it isn't just matter of CSS :) Indeed that would be much easier :)
I need to change structure of HTML itself too.

If you want to avoid passing it as an argument, just be sure that the
global variable is of type TaskLocal!HTTPServerRequest instead of just
HTTPServerRequest, so that multiple concurrent requests don't get
mixed up. If that's given, there is nothing from a safety perspective
that speaks against it.

BTW, there is already such a variable in vibe.web.web
(s_requestContext). It may not be the worst idea to somehow expose
it's contents apart from the current SessionVar support.

Yeah and I am using it at the moment.
But I had to manualy change it's visibility from private to public although I would prefer to stay with ~master version of vibed within my project.