def create(self, data): entry = BiblatexEntry() entry.entry_type = self.type.name form.applyChanges(self, entry, data) # Grant the current user the Edit permission by assigning him # the quotationtool.Creator role, but only locally in the # context of the newly created object. manager = IPrincipalRoleManager(entry) manager.assignRoleToPrincipal('quotationtool.Creator', self.request.principal.id) return entry
def create(self, data): description = CategorizableItemDescription() form.applyChanges(self, description, data) # Grant the current user the Edit permission by assigning him # the quotationtool.Creator role, but only locally in the # context of the newly created object. manager = IPrincipalRoleManager(description) manager.assignRoleToPrincipal('quotationtool.Creator', self.request.principal.id) return description
def create(self, data): obj = zope.component.createObject( 'quotationtool.biblatex.biblatexentry.BiblatexEntry') form.applyChanges(self, obj, data) # Grant the current user the Edit permission by assigning him # the quotationtool.Creator role, but only locally in the # context of the newly created object. manager = IPrincipalRoleManager(obj) manager.assignRoleToPrincipal('quotationtool.Creator', self.request.principal.id) return obj
def create(self, data): category_set = CategorySet() form.applyChanges(self, category_set, data) # Grant the current user the Edit permission by assigning him # the quotationtool.Creator role, but only locally in the # context of the newly created object. manager = IPrincipalRoleManager(category_set) manager.assignRoleToPrincipal( 'quotationtool.Creator', self.request.principal.id) return category_set
def create(self, data): obj = Comment() form.applyChanges(self, obj, data) obj.source_type = 'html' obj.about = removeAllProxies(self.context) # Grant the current user the Edit permission by assigning him # the quotationtool.Creator role, but only locally in the # context of the newly created object. manager = IPrincipalRoleManager(obj) manager.assignRoleToPrincipal('quotationtool.Creator', self.request.principal.id) return obj
def create(self, data): quotation = zope.component.createObject(self.factory_name) form.applyChanges(self, quotation, data) quotation.source_type = 'html' # We want an object which is not security proxied as reference # attribute: quotation.reference = removeAllProxies(self.context) # Grant the current user the Edit permission by assigning him # the quotationtool.Creator role, but only locally in the # context of the newly created object. manager = IPrincipalRoleManager(quotation) manager.assignRoleToPrincipal('quotationtool.Creator', self.request.principal.id) return quotation
def create(self, data): if data['__name__']: self.category_name = data['__name__'] else: self.category_name = data['title'] #interfaces.checkCategoryName(self.category_name, context=self.context) category = Category() del data['__name__'] form.applyChanges(self, category, data) # Grant the current user the Edit permission by assigning him # the quotationtool.Creator role, but only locally in the # context of the newly created object. manager = IPrincipalRoleManager(category) manager.assignRoleToPrincipal('quotationtool.Creator', self.request.principal.id) return category
def applyChanges(self, data): """Generic form save method taken from z3c.form.form.EditForm.""" content = self.getContent() changes = form.applyChanges(self, content, data) # ``changes`` is a dictionary; if empty, there were no changes if changes: # Construct change-descriptions for the object-modified event descriptions = [] for interface, names in changes.items(): descriptions.append( zope.lifecycleevent.Attributes(interface, *names)) # Send out a detailed object-modified event zope.event.notify( zope.lifecycleevent.ObjectModifiedEvent( content, *descriptions)) return changes
def create(self, data): ob = Issue() form.applyChanges(self, ob, data) return ob
def create(self, data): ob = Question() form.applyChanges(self, ob, data) return ob
def create(self, data): status = EditorialStatus() form.applyChanges(self, status, data) return status