示例#1
0
 def setup_monitors(self):
     finders = []
     if self.options.all:
         devs = Device.enabled()
     else:
         devs = []
         for o in self.options.devices:
             devs.append(Device.findBy(int(o)))
         
     log.warn('configurando %s dispositivos',len(devs))
     for d in devs:
         f = Finder(d)
         f.start()
         finders.append(f)
         self.server.add(d.outstream)
     return finders
def view(request):
    device_id = int(request.matchdict.get('id', -1))
    device = Device.findBy(device_id) if device_id>0 else  Device.first()
    if not device:
        return HTTPNotFound()
    return {'device':device}