コード例 #1
0
ファイル: main.py プロジェクト: Afey/bokeh
def deletedoc(docid):
    bokehuser = bokeh_app.current_user()
    try:
        bokehuser.remove_doc(docid)
        bokehuser.save(bokeh_app.servermodel_storage)
    except DataIntegrityException as e:
        return abort(409, e.message)
    jsonstring = protocol.serialize_web(bokehuser.to_public_json())
    msg = protocol.serialize_web({'msgtype' : 'docchange'})
    bokeh_app.publisher.send("bokehuser:" + bokehuser.username, msg)
    return make_json(jsonstring)
コード例 #2
0
ファイル: main.py プロジェクト: mcdonc/pyramid_bokehserver
def deletedoc(request):
    docid = request.matchdict['docid']
    bokehuser = request.current_user()
    try:
        bokehuser.remove_doc(docid)
        bokehuser.save(request.registry.servermodel_storage)
    except DataIntegrityException as e:
        return HTTPConflict(e.message)
    jsonstring = protocol.serialize_web(bokehuser.to_public_json())
    msg = protocol.serialize_web({'msgtype' : 'docchange'})
    request.registry.publisher.send("bokehuser:" + bokehuser.username, msg)
    return jsonstring
コード例 #3
0
ファイル: main.py プロジェクト: Afey/bokeh
def makedoc():
    if request.json:
        title = request.json['title']
    else:
        title = request.values['title']
    bokehuser = bokeh_app.current_user()
    try:
        _makedoc(bokeh_app.servermodel_storage, bokehuser, title)
    except DataIntegrityException as e:
        return abort(409, e.message)
    jsonstring = protocol.serialize_web(bokehuser.to_public_json())
    msg = protocol.serialize_web({'msgtype' : 'docchange'})
    bokeh_app.publisher.send("bokehuser:" + bokehuser.username, msg)
    return make_json(jsonstring)
コード例 #4
0
ファイル: main.py プロジェクト: mcdonc/pyramid_bokehserver
def makedoc(request):
    json_body = request.json_body
    if json_body:
        title = json_body['title']
    else:
        title = request.params['title']
    bokehuser = request.current_user()
    try:
        _makedoc(request.registry.servermodel_storage, bokehuser, title)
    except DataIntegrityException as e:
        return HTTPConflict(e.message)
    jsonstring = protocol.serialize_web(bokehuser.to_public_json())
    msg = protocol.serialize_web({'msgtype' : 'docchange'})
    request.registry.publisher.send("bokehuser:" + bokehuser.username, msg)
    return jsonstring
コード例 #5
0
ファイル: session.py プロジェクト: trottier/Bokeh
 def make_doc(self, title):
     url = urlparse.urljoin(self.root_url,"/bokeh/doc/")
     data = protocol.serialize_web({'title' : title})
     response = self.http_session.post(url, data=data, verify=False)
     if response.status_code == 409:
         raise DataIntegrityException
     self.userinfo = utils.get_json(response)
コード例 #6
0
ファイル: handler.py プロジェクト: CaptainAL/Spyder
 def on_message(self, message):
     msgobj = protocol.deserialize_json(message)
     msgtype = msgobj.get('msgtype')
     if msgtype == 'subscribe':
         auth = msgobj['auth']
         topic = msgobj['topic']
         if self.manager.auth(auth, topic):
             self.manager.subscribe(self.clientid, topic)
             msg = protocol.serialize_json(
                 protocol.status_obj(['subscribesuccess', topic, self.clientid])
             )
             self.write_message(topic + ":" + msg)
         else:
             msg = protocol.serialize_web(protocol.error_obj('unauthorized'))
             self.write_message(topic + ":" + msg)
コード例 #7
0
ファイル: main.py プロジェクト: Afey/bokeh
def doc_by_title():
    if request.json:
        title = request.json['title']
    else:
        title = request.values['title']
    bokehuser = bokeh_app.current_user()
    docs = [doc for doc in bokehuser.docs if doc['title'] == title]
    if len(docs) == 0:
        try:
            doc = _makedoc(bokeh_app.servermodel_storage, bokehuser, title)
            docid = doc.docid
        except DataIntegrityException as e:
            return abort(409, e.message)
        msg = protocol.serialize_web({'msgtype' : 'docchange'})
        bokeh_app.publisher.send("bokehuser:" + bokehuser.username, msg)
    else:
        doc = docs[0]
        docid = doc['docid']
    return get_bokeh_info(docid)
コード例 #8
0
ファイル: main.py プロジェクト: mcdonc/pyramid_bokehserver
def doc_by_title(request):
    json_body = request.json_body
    if json_body:
        title = json_body['title']
    else:
        title = request.params['title']
    bokehuser = request.current_user()
    docs = [doc for doc in bokehuser.docs if doc['title'] == title]
    if len(docs) == 0:
        try:
            doc = _makedoc(
                request, request.registry.servermodel_storage, bokehuser, title
                )
            docid = doc.docid
        except DataIntegrityException as e:
            return HTTPConflict(e.message)
        msg = protocol.serialize_web({'msgtype' : 'docchange'})
        request.registry.publisher.send("bokehuser:" + bokehuser.username, msg)
    else:
        doc = docs[0]
        docid = doc['docid']
    return _get_bokeh_info(request, docid)
コード例 #9
0
ファイル: main.py プロジェクト: Afey/bokeh
def get_user():
    bokehuser = bokeh_app.current_user()
    if not bokehuser:
        abort(403)
    content = protocol.serialize_web(bokehuser.to_public_json())
    return make_json(content)
コード例 #10
0
ファイル: main.py プロジェクト: gettis/monitoring_app
def get_user():
    bokehuser = bokeh_app.current_user()
    content = protocol.serialize_web(bokehuser.to_public_json())
    return make_json(content)
コード例 #11
0
ファイル: serverbb.py プロジェクト: mekman/Bokeh
 def bbset(self, client, key, model):
     return client.set(key, protocol.serialize_web(
         model.to_json(include_hidden=True)))
コード例 #12
0
ファイル: main.py プロジェクト: mcdonc/pyramid_bokehserver
def get_user(request):
    bokehuser = request.current_user()
    content = protocol.serialize_web(bokehuser.to_public_json())
    return content