Esempio n. 1
0
def main (args, app):
  vendor = vendors.lookup(args.vendor, app.config)
  device = Device(args.name, vendor)
  device.read(args=args)
  app.config.add_device(device)
  # print device, device.items( )
  # app.config.write(sys.stdout)
  app.config.save( )
  print "added", device.format_url( )
Esempio n. 2
0
 def FromConfig (klass, vendors, config):
   devices = [ ]
   for candidate in config.sections( ):
     if candidate.startswith(klass.prefix):
       name = json.loads(candidate.split(' ').pop( ))
       vendor = vendors.lookup(config.get(candidate, 'vendor').split('.').pop( ), config)
       device = klass(name, vendor)
       device.read(config=config)
       devices.append(device)
   return devices
Esempio n. 3
0
def main(args, app):
    # print "adding", app.selected.vendors.selected(args).method
    # device = app.selected.vendors.selected(args)(args, app)
    vendor = vendors.lookup(args.vendor)
    print "MY vendor", vendor
    print args
    device = Device(args.name, vendor)
    device.read(args=args)
    app.config.add_device(device)
    print device, device.items()
    app.config.write(sys.stdout)
    app.config.save()
Esempio n. 4
0
def main (args, app):
  # print "adding", app.selected.vendors.selected(args).method
  # device = app.selected.vendors.selected(args)(args, app)
  vendor = vendors.lookup(args.vendor)
  print "MY vendor", vendor
  print args
  device = Device(args.name, vendor)
  device.read(args=args)
  app.config.add_device(device)
  print device, device.items( )
  app.config.write(sys.stdout)
  app.config.save( )