Пример #1
0
 def GET(self):
     session = cherrypy.request.db
     cherrypy.response.headers['content-type'] = 'text/xml'
     msg = "<backends>\n"
     backends = Backend.get_all(session)
     for backend in backends:
         msg += Backend.export_one(backend, "all").decode() + "\n"
     msg += "<backends>\n<monitors>\n"
     monitors = Monitor.get_all(session)
     for monitor in monitors:
         msg += Monitor.export_one(monitor, "all").decode() + "\n"
     msg += "</monitors>\n<nodes>\n"
     nodes = Node.get_all(session)
     for node in nodes:
         msg += Node.export_one(node, "all").decode() + "\n"
     msg += "</nodes>\n<rooms>\n"
     rooms = Room.get_all(session)
     for room in rooms:
         msg += Room.export_one(room, "all").decode() + "\n"
     msg += "</rooms>\n<users>\n"
     users = User.get_all(session)
     for user in users:
         msg += User.export_one(user, "all").decode() + "\n"
     msg += "</users>"
     return msg
Пример #2
0
def send_requests(roles, method, type, name, attrib, value, value_type):
    session = cherrypy.request.db
    elements = []
    if "backend" in roles:
        elements.extend(Backend.get_all(session, active=True))
    if "monitor" in roles:
        elements.extend(Monitor.get_all(session, active=True))
    if "user" in roles:
        elements.extend(User.get_all(session, "room", roles["user"], active=True))
    for element in elements:
        response = send_request(element, method, type, value, name, attrib)