I want to be able to call embed_js on a plot that was created in a server session.  without moving embed_js up to Session, I don’t see how this is possible.  embed_js should probably be _embed_js  so it’s private.  

The user should be able to call generate_html_snippet on any plot and not worry about what type of session the plot was created in.

The inheritance scheme does seem overly complex to me too.  But we should be able to eliminate HTMLFragmentSession.


On Mar 13, 2014, at 7:04 PM, Mateusz Paprocki <notifications@github.com> wrote:

> In bokeh/session/session.py:
> 
> > @@ -99,3 +99,19 @@ def view(self):
> >          that is connected to this session.
> >          """
> >          raise NotImplementedError
> > +
> > +    def embed_js(self, plot_id, static_root_url):
> Given the current inheritance structure, this is wrong place to put embed_js() in, because it uses methods from Session's subclasses BaseJSONSession (serialize_models(), get_ref(), make_id()) and BaseHTMLSession (_load_template()). There is also plotcontext, but that's redefined everywhere.
> 
> I presume this is needed together with PlotServerSession? PlotServerSession inherits from BaseHTMLSession, so straight forward solution is to put embed_js() in BaseHTMLSession. plotcontext still will be defined in a subclass, but that has to be universally fixed, so it shouldn't matter here.
> 
> —
> Reply to this email directly or view it on GitHub.
>