Beispiel #1
0
    def adddevice(self, **kw):
	"""Add a driver to a device and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	driver = Driver.by_driver_id(kw['driver_id'])
	device = Device.by_device_name(kw['device'])
	driver.devices.append(device)
	DBSession.flush()
	redirect("/drivers/"+driver.name)
Beispiel #2
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 #3
0
 def setup(self):
     try:
         new_attrs = {}
         new_attrs.update(self.attrs)
         new_attrs.update(self.do_get_dependencies())
         self.obj = self.klass(**new_attrs)
         DBSession.add(self.obj)
         DBSession.flush()
         return self.obj
     except:
         DBSession.rollback()
         raise
Beispiel #4
0
    def addalias(self, **kw):
	"""Create a new device alias and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	alias = kw['alias']
	device = Device.by_device_id(kw['device_id'])
	owner = device.state.owner
	comment = alias
	devicealias = DeviceAlias()
	devicealias.alias = alias
	devicealias.device = device
	devicealias.state.creator = user
	devicealias.state.owner = owner
	devicealias.comments.append(Comment(comment=comment))
	DBSession.add(device)
	DBSession.flush()
	redirect("/devices/"+device.name)
Beispiel #5
0
    def create(self, **kw):
	"""Create a new drivertype and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	name = kw['name']
	comment = kw['comment']
	owner = User.by_user_name(kw['owner'])
	if comment == "":
		comment = name
	drivertype = DriverType()
	drivertype.name = name
	drivertype.state.creator = user
	drivertype.state.owner = owner
	drivertype.comments.append(Comment(comment=comment))
	DBSession.add(drivertype)
	DBSession.flush()
	redirect("index")
Beispiel #6
0
    def create(self, **kw):
	"""Create a new osfamily and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	name = kw['name']
	vendor = Vendor.by_vendor_name(kw['vendor'])
	comment = kw['comment']
	owner = User.by_user_name(kw['owner'])
	if comment == "":
		comment = name
	osfamily = OSFamily()
	osfamily.name = name
	osfamily.vendor = vendor
	osfamily.state.creator = user
	osfamily.state.owner = owner
	osfamily.comments.append(Comment(comment=comment))
	DBSession.add(osfamily)
	DBSession.flush()
	redirect("index")
Beispiel #7
0
    def create(self, **kw):
	"""Create a new vendor and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	name = kw['name']
	website = kw['website']
	comment = kw['comment']
	owner = User.by_user_name(kw['owner'])
	if comment == "":
		comment = name
	vendor = Vendor()
	vendor.name = name
	vendor.website = website
	vendor.state.creator = user
	vendor.state.owner = owner
	vendor.comments.append(Comment(comment=comment))
	DBSession.add(vendor)
	DBSession.flush()
	redirect("index")
Beispiel #8
0
    def addmeta(self, **kw):
	"""Create a new device alias and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	driverbuild = DriverBuild.by_driverbuild_id(kw['driverbuild_id'])
	tag = kw['tag']
	value = kw['value']
	owner = driverbuild.state.owner
	comment = tag
	driverbuildmeta = DriverBuildMeta()
	driverbuildmeta.driverbuild = driverbuild
	driverbuildmeta.tag = tag
	driverbuildmeta.value = value
	driverbuildmeta.state.creator = user
	driverbuildmeta.state.owner = owner
	driverbuildmeta.comments.append(Comment(comment=comment))
	DBSession.add(driverbuildmeta)
	DBSession.flush()
	redirect("/drivers/"+driverbuild.driver.name)
Beispiel #9
0
    def create(self, **kw):
	"""Create a new license and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	name = kw['name']
	if kw['free']=='True':
		free=True
	else:
		free=False
	comment = kw['comment']
	owner = User.by_user_name(kw['owner'])
	if comment == "":
		comment = name
	license = License()
	license.name = name
	license.free = free
	license.state.creator = user
	license.state.owner = owner
	license.comments.append(Comment(comment=comment))
	DBSession.add(license)
	DBSession.flush()
	redirect("index")
Beispiel #10
0
    def create(self, **kw):
	"""Create a new device and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	name = kw['name']
	vendor = Vendor.by_vendor_name(kw['vendor'])
	devicetype = DeviceType.by_devicetype_name(kw['type'])
	version = kw['version']
	comment = kw['comment']
	owner = User.by_user_name(kw['owner'])
	if comment == "":
		comment = name
	device = Device()
	device.name = name
	device.vendor = vendor
	device.devicetype = devicetype
	device.version = version
	device.state.creator = user
	device.state.owner = owner
	device.comments.append(Comment(comment=comment))
	DBSession.add(device)
	DBSession.flush()
	redirect("index")
Beispiel #11
0
    def create(self, **kw):
	"""Create a new kernel and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	name = kw['name']
	arch = Arch.by_arch_name(kw['arch'])
	osrelease = OSRelease.by_osrelease_name(kw['osrelease'])
	vendor = Vendor.by_vendor_name(kw['vendor'])
	comment = kw['comment']
	owner = User.by_user_name(kw['owner'])
	if comment == "":
		comment = name
	kernel = Kernel()
	kernel.name = name
	kernel.arch = arch
	kernel.osrelease = osrelease
	kernel.vendor = vendor
	kernel.state.creator = user
	kernel.state.owner = owner
	kernel.comments.append(Comment(comment=comment))
	DBSession.add(kernel)
	DBSession.flush()
	redirect("index")
Beispiel #12
0
    def create(self, **kw):
	"""Create a new device and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	name = kw['name']
	vendor = Vendor.by_vendor_name(kw['vendor'])
	systemfamily = SystemFamily.by_systemfamily_name(kw['family'])
	version = kw['version']
	comment = kw['comment']
	owner = User.by_user_name(kw['owner'])
	if comment == "":
		comment = name
	system = System()
	system.name = name
	system.vendor = vendor
	system.systemfamily = systemfamily
	system.version = version
	system.state.creator = user
	system.state.owner = owner
	system.comments.append(Comment(comment=comment))
	DBSession.add(system)
	DBSession.flush()
	redirect("index")
Beispiel #13
0
    def create(self, **kw):
	"""Create a new driverbuild and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	driver = Driver.by_driver_id(kw['driver_id'])
	kernel = Kernel.by_kernel_name(kw['kernel'])
	vendor = Vendor.by_vendor_name(kw['vendor'])
	version = kw['version']
	comment = kw['comment']
	owner = User.by_user_name(kw['owner'])
	if comment == "":
		comment = name
	driverbuild = DriverBuild()
	driverbuild.driver = driver
	driverbuild.kernel = kernel
	driverbuild.vendor = vendor
	driverbuild.version = version
	driverbuild.state.creator = user
	driverbuild.state.owner = owner
	driverbuild.comments.append(Comment(comment=comment))
	DBSession.add(driverbuild)
	DBSession.flush()
	redirect("/drivers/"+driver.name)
Beispiel #14
0
    def create(self, **kw):
	"""Create a new driver and save it to the database."""
	user = request.environ.get('repoze.who.identity')['user']
	name = kw['name']
	drivertype = DriverType.by_drivertype_name(kw['type'])
	license = License.by_license_name(kw['license'])
	vendor = Vendor.by_vendor_name(kw['vendor'])
	version = kw['version']
	comment = kw['comment']
	owner = User.by_user_name(kw['owner'])
	if comment == "":
		comment = name
	driver = Driver()
	driver.name = name
	driver.drivertype = drivertype
	driver.license = license
	driver.vendor = vendor
	driver.version = version
	driver.state.creator = user
	driver.state.owner = owner
	driver.comments.append(Comment(comment=comment))
	DBSession.add(driver)
	DBSession.flush()
	redirect("index")