Ejemplo n.º 1
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)
Ejemplo n.º 2
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)