Beispiel #1
0
    def addsystem(self, **kw):
	"""Add a system to a device and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	device = Device.by_device_id(kw['device_id'])
	system = System.by_system_name(kw['system'])
	device.systems.append(system)
	DBSession.flush()
	redirect("/devices/"+device.name)
Beispiel #2
0
    def default(self, *args):
	admin=False
	if predicates.not_anonymous():
		if predicates.has_permission('admin'):
			admin=True
	system_name = args[0]
	system = System.by_system_name(system_name)
	devices = system.devices
	return dict(system=system, devices=devices,
		    admin=admin)