Example #1
0
 def get_node(self, service, node):
     if not self.nodes:
         self.get_nodes(service)
     xml = self.pubsub.get_node_config(self.args.pubsub_service, node=node).find('{http://jabber.org/protocol/pubsub#owner}pubsub/{http://jabber.org/protocol/pubsub#owner}configure/{jabber:x:data}x')
     form = Form(xml=xml)
     if not node in self.nodes.keys():
         raise cherrypy.HTTPError(404)
     return json.dumps({'node': [{
         'name': node,
         'title': self.nodes.get(node),
         'config': form.get_values(),
         }]})
Example #2
0
 def POST(self):
     body = json.loads(cherrypy.request.body.read(int(cherrypy.request.headers['Content-Length'])))
     config = Form(None, title='Node Config Form')
     config.addField('FORM_TYPE', 'hidden', value='http://jabber.org/protocol/pubsub#node_config')
     config.addField('pubsub#title', value=body.get('title'))
     config.addField('pubsub#access_model', value="whitelist")
     config.addField('pubsub#presence-subscribe', value="true")
     self.pubsub.create_node(self.args.pubsub_service, body.get('name'), config=config)
     cherrypy.response.status = 201
Example #3
0
 def POST(self):
     body = json.loads(
         cherrypy.request.body.read(
             int(cherrypy.request.headers['Content-Length'])))
     config = Form(None, title='Node Config Form')
     config.addField('FORM_TYPE',
                     'hidden',
                     value='http://jabber.org/protocol/pubsub#node_config')
     config.addField('pubsub#title', value=body.get('title'))
     config.addField('pubsub#access_model', value="whitelist")
     config.addField('pubsub#presence-subscribe', value="true")
     self.pubsub.create_node(self.args.pubsub_service,
                             body.get('name'),
                             config=config)
     cherrypy.response.status = 201
Example #4
0
 def get_node(self, service, node):
     if not self.nodes:
         self.get_nodes(service)
     xml = self.pubsub.get_node_config(
         self.args.pubsub_service, node=node
     ).find(
         '{http://jabber.org/protocol/pubsub#owner}pubsub/{http://jabber.org/protocol/pubsub#owner}configure/{jabber:x:data}x'
     )
     form = Form(xml=xml)
     if not node in self.nodes.keys():
         raise cherrypy.HTTPError(404)
     return json.dumps({
         'node': [{
             'name': node,
             'title': self.nodes.get(node),
             'config': form.get_values(),
         }]
     })