(view_func)
return wraps(view_func)(_decorator)
Decorator for creating views that return pylab images as a JSON object filled with base64 encoded pngs.
    Adds querystring options for performing scaling.
Decorator for creating views that return pylab images as a JSON object filled with base64 encoded pngs.
    Adds querystring options for performing scaling.
Decorator for creating views that return pylab images as a JSON object filled with base64 encoded pngs . Adds querystring options for performing scaling .
def pylabToJsonBase64PNGs(view_func):
    """
    Decorator for creating views that return pylab images as a JSON object filled with base64 encoded pngs.
    Adds querystring options for performing scaling.
    """
    def _decorator(*args, **kwargs):
        images_data = view_func(*args, **kwargs)
        transformer = lambda buf: "data:image/png;base64,%s" % base64.b64encode(_image_to_png(buf)).decode("ascii")
        images_data = mapterminals(transformer, images_data)

        return Response(json.dumps(images_data), mimetype="application/json")
    return wraps(view_func)(_decorator)
def pylabToJsonBase64PNGs ( view_func ) : def _decorator ( * args , * * kwargs ) : images_data = view_func ( * args , * * kwargs ) transformer = lambda buf : "data:image/png;base64,%s" % base64 . b64encode ( _image_to_png ( buf ) ) . decode ( "ascii" ) images_data = mapterminals ( transformer , images_data ) return Response ( json . dumps ( images_data ) , mimetype = "application/json" ) return wraps ( view_func ) ( _decorator )