Jinja template

Hi,

First of all, thanks for this great library.

I am developing an application using bokeh server. I would like to pass information to a jinja template. Is that possible? I have seen cases for passing the title of the page, but no example for other cases. Ex. passing ‘model_name’:

Training Statistics

{{ bokeh_css }}

{{ bokeh_js }}

Training Statistics on Experiment {{ model_name }}

{{ plot_div|indent(8) }}

{{ plot_script|indent(8) }}

Carlos.

I just took a look, and it seems not quite. It looks like some of the plumbing is already in place, but there's no place to actually specify additional template variables to get passed on yet. First I'd encourage you to submit a GH feature request issue for this. Then, I'd ask you to consider working (with some help) on a PR to add this feature. I don't think it's alot of work and I would be very happy to answer questions and provide guidance. But looking at it myself would probably be a few months away at least, I am under some tight deadlines in other areas at the moment. ]

Thanks,

Bryan

···

On Sep 20, 2016, at 11:59 AM, Carlos Silva <[email protected]> wrote:

Hi,

First of all, thanks for this great library.

I am developing an application using bokeh server. I would like to pass information to a jinja template. Is that possible? I have seen cases for passing the title of the page, but no example for other cases. Ex. passing 'model_name':

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Training Statistics</title>
        {{ bokeh_css }}
        {{ bokeh_js }}
    </head>
    <body>
        <h1>Training Statistics on Experiment {{ model_name }}</h1>
        {{ plot_div|indent(8) }}
        {{ plot_script|indent(8) }}
    </body>
</html>

Carlos.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/c99cf66b-2ae1-4b2b-a398-126bb579447c%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Outline of necessary work:

* These two functions need a new optional "template_variables = {}" parameter:

  https://github.com/bokeh/bokeh/blob/6aa55d9650f641b0f1d62f9b4499cf6d284f3f48/bokeh/embed.py#L596-L623

The both need to pass that parameter to the function they call at the end.

* The doc handler needs to pass a value for template_variables here:

  https://github.com/bokeh/bokeh/blob/master/bokeh/server/views/doc_handler.py#L30

* Document class needs to get initialized with a default property for template_variables

Then, if you set curdoc().template_variables, it should make it all the way through to where the template is actually used.

An especially good PR would also add some tests around this but those could be discussed in the PR.

Thanks,

Bryan

···

On Sep 20, 2016, at 12:18 PM, Bryan Van de Ven <[email protected]> wrote:

I just took a look, and it seems not quite. It looks like some of the plumbing is already in place, but there's no place to actually specify additional template variables to get passed on yet. First I'd encourage you to submit a GH feature request issue for this. Then, I'd ask you to consider working (with some help) on a PR to add this feature. I don't think it's alot of work and I would be very happy to answer questions and provide guidance. But looking at it myself would probably be a few months away at least, I am under some tight deadlines in other areas at the moment. ]

Thanks,

Bryan

On Sep 20, 2016, at 11:59 AM, Carlos Silva <[email protected]> wrote:

Hi,

First of all, thanks for this great library.

I am developing an application using bokeh server. I would like to pass information to a jinja template. Is that possible? I have seen cases for passing the title of the page, but no example for other cases. Ex. passing 'model_name':

<!DOCTYPE html>
<html lang="en">
   <head>
       <meta charset="utf-8">
       <title>Training Statistics</title>
       {{ bokeh_css }}
       {{ bokeh_js }}
   </head>
   <body>
       <h1>Training Statistics on Experiment {{ model_name }}</h1>
       {{ plot_div|indent(8) }}
       {{ plot_script|indent(8) }}
   </body>
</html>

Carlos.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/c99cf66b-2ae1-4b2b-a398-126bb579447c%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I have looked at the source code you indicated. The only problem I see is not with the code, but the process you use (git, PR, and test).

Carlos.

terça-feira, 20 de Setembro de 2016 às 18:18:16 UTC+1, Bryan Van de ven escreveu:

···

I just took a look, and it seems not quite. It looks like some of the plumbing is already in place, but there’s no place to actually specify additional template variables to get passed on yet. First I’d encourage you to submit a GH feature request issue for this. Then, I’d ask you to consider working (with some help) on a PR to add this feature. I don’t think it’s alot of work and I would be very happy to answer questions and provide guidance. But looking at it myself would probably be a few months away at least, I am under some tight deadlines in other areas at the moment. ]

Thanks,

Bryan

On Sep 20, 2016, at 11:59 AM, Carlos Silva [email protected] wrote:

Hi,

First of all, thanks for this great library.

I am developing an application using bokeh server. I would like to pass information to a jinja template. Is that possible? I have seen cases for passing the title of the page, but no example for other cases. Ex. passing ‘model_name’:

<head>
    <meta charset="utf-8">
    <title>Training Statistics</title>
    {{ bokeh_css }}
    {{ bokeh_js }}
</head>
<body>
    <h1>Training Statistics on Experiment  {{ model_name }}</h1>
    {{ plot_div|indent(8) }}
    {{ plot_script|indent(8) }}
</body>

Carlos.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/c99cf66b-2ae1-4b2b-a398-126bb579447c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.