Validation on server_lifecycle.py

Hi everyone,

I’m trying to do a validation on my server_cycle.py more specifically atdef on_session_created(session_context):**

I trying to validate a token and case this token is valid it shows the bokeh report (main.py) otherwise it should return an error or redirect to an error page. Is there a way to it with bokeh? Maybe something like:

def on_session_created(session_context):

.

.

.

#tokenNotValid

else

session_context.destroy()

return Error

Thank you!

Ricardo

Hi,

There is nothing currently built in, although it seems like a fairly reasonable and useful feature, and perhaps not so hard to implement either, so I'd suggest making a GH feature request issue for it.

In the mean time the best suggestion I can offer is to have the lifecycle callback set some state on the session, and then have the app have a big top-level "if" statement that does something like only add a bit "error div" curdoc (instead of whatever it normally does) in case the validation failed.

Thanks,

Bryan

···

On Feb 10, 2017, at 12:49, Ricardo Vinci <[email protected]> wrote:

Hi everyone,

I'm trying to do a validation on my server_cycle.py more specifically at def on_session_created(session_context):

I trying to validate a token and case this token is valid it shows the bokeh report (main.py) otherwise it should return an error or redirect to an error page. Is there a way to it with bokeh? Maybe something like:

def on_session_created(session_context):
.
.
.
#tokenNotValid
else
session_context.destroy()
return Error

Thank you!

Ricardo

--
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/54b113ec-7e44-40d5-92a2-86628f400ad6%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks for the suggestion Bryan! I’ve just posted the feature request on GH.

Best,

Ricardo

···

On Monday, February 13, 2017 at 10:43:48 AM UTC-5, Bryan Van de ven wrote:

Hi,

There is nothing currently built in, although it seems like a fairly reasonable and useful feature, and perhaps not so hard to implement either, so I’d suggest making a GH feature request issue for it.

In the mean time the best suggestion I can offer is to have the lifecycle callback set some state on the session, and then have the app have a big top-level “if” statement that does something like only add a bit “error div” curdoc (instead of whatever it normally does) in case the validation failed.

Thanks,

Bryan

On Feb 10, 2017, at 12:49, Ricardo Vinci [email protected] wrote:

Hi everyone,

I’m trying to do a validation on my server_cycle.py more specifically at def on_session_created(session_context):

I trying to validate a token and case this token is valid it shows the bokeh report (main.py) otherwise it should return an error or redirect to an error page. Is there a way to it with bokeh? Maybe something like:

def on_session_created(session_context):

.

.

.

#tokenNotValid

else

session_context.destroy()

return Error

Thank you!

Ricardo


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/54b113ec-7e44-40d5-92a2-86628f400ad6%40continuum.io.

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