Ejemplo n.º 1
0
    def default(self, *args):
	admin=False
	if predicates.not_anonymous():
		if predicates.has_permission('admin'):
			admin=True
	kernel_name = args[0]
	kernel = Kernel.by_kernel_name(kernel_name)
	return dict(kernel=kernel,
		    admin=admin)
Ejemplo n.º 2
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)