def edit(self, id): c.form = 'edit' c.role = Role.find_by_id(id) defaults = h.object_to_defaults(c.role, 'role') form = render('/role/edit.mako') return htmlfill.render(form, defaults)
def delete(self, id): """Delete the role GET will return a form asking for approval. POST requests will delete the item. """ c.role = Role.find_by_id(id) return render('role/confirm_delete.mako')
def role_exists(self, role): """ Returns ``True`` if the role exists, ``False`` otherwise. Roles are case insensitive. """ role = Role.find_by_name(role) if role is not None: return True return False
def review_index(self): c.person = h.signed_in_person() c.num_proposals = 0 reviewer_role = Role.find_by_name('funding_reviewer') c.num_reviewers = len(reviewer_role.people) for ft in c.funding_types: stuff = Funding.find_all_by_funding_type_id(ft.id, include_withdrawn=False) c.num_proposals += len(stuff) setattr(c, '%s_collection' % ft.name, stuff) return render('funding/list_review.mako')
def review_index(self): c.person = h.signed_in_person() c.num_proposals = 0 reviewer_role = Role.find_by_name('funding_reviewer') c.num_reviewers = len(reviewer_role.people) for ft in c.funding_types: stuff = Funding.find_all_by_funding_type_id( ft.id, include_withdrawn=False) c.num_proposals += len(stuff) setattr(c, '%s_collection' % ft.name, stuff) return render('funding/list_review.mako')
def _edit(self, id): c.role = Role.find_by_id(id) for key in self.form_result['role']: setattr(c.role, key, self.form_result['role'][key]) if c.role.pretty_name is not None and c.role.pretty_name == '': setattr(c.role, 'pretty_name', None) # update the objects with the validated form data meta.Session.commit() redirect_to(action='view', id=id)
def _roles(self, id): """ Lists and changes the person's roles. """ c.person = Person.find_by_id(id) c.roles = Role.find_all() role = self.form_result['role'] action = self.form_result['action'] role = Role.find_by_name(name=role) if action == 'Revoke' and role in c.person.roles: c.person.roles.remove(role) h.flash('Role ' + role.name + ' Revoked') elif action == 'Grant' and role not in c.person.roles: c.person.roles.append(role) h.flash('Role ' + role.name + ' Granted') else: h.flash("Nothing to do") meta.Session.commit() return render('person/roles.mako')
def review_index(self): c.person = h.signed_in_person() c.num_proposals = 0 reviewer_role = Role.find_by_name('reviewer') c.num_reviewers = len(reviewer_role.people) for pt in c.proposal_types: stuff = Proposal.find_all_by_proposal_type_id(pt.id, include_withdrawn=False) c.num_proposals += len(stuff) setattr(c, '%s_collection' % pt.name, stuff) for aat in c.accommodation_assistance_types: stuff = Proposal.find_all_by_accommodation_assistance_type_id(aat.id) setattr(c, '%s_collection' % aat.name, stuff) for tat in c.travel_assistance_types: stuff = Proposal.find_all_by_travel_assistance_type_id(tat.id) setattr(c, '%s_collection' % tat.name, stuff) return render('proposal/list_review.mako')
def review_index(self): c.person = h.signed_in_person() c.num_proposals = 0 reviewer_role = Role.find_by_name('reviewer') c.num_reviewers = len(reviewer_role.people) for pt in c.proposal_types: stuff = Proposal.find_all_by_proposal_type_id( pt.id, include_withdrawn=False) c.num_proposals += len(stuff) setattr(c, '%s_collection' % pt.name, stuff) for aat in c.accommodation_assistance_types: stuff = Proposal.find_all_by_accommodation_assistance_type_id( aat.id) setattr(c, '%s_collection' % aat.name, stuff) for tat in c.travel_assistance_types: stuff = Proposal.find_all_by_travel_assistance_type_id(tat.id) setattr(c, '%s_collection' % tat.name, stuff) return render('proposal/list_review.mako')
def roles(self, id): c.person = Person.find_by_id(id) c.roles = Role.find_all() return render('person/roles.mako')
def view(self, id): c.registration_status = h.config['app_conf'].get('registration_status') c.role = Role.find_by_id(id) return render('role/view.mako')
def index(self): c.role_collection = Role.find_all() return render('/role/list.mako')
def _delete(self, id): c.role = Role.find_by_id(id) meta.Session.delete(c.role) meta.Session.commit() redirect_to('index')