def showgroup(groupname): if not session.get('logged_in'): return redirect(url_for('login')) config = ConfigObj(path_to_conf()) section = 'group ' + groupname if section not in config: flash('Group not found') return redirect(url_for('index')) return render_template('group.html', config=config, group=groupname, section=section)
def remove_project_person(groupname, person): config = ConfigObj(path_to_conf()) section = 'group ' + groupname members = config[section]['members'].split() if person in members: members.remove(person) config[section]['members'] = ' '.join(members) try: config.write() flash('Deleted person') except: flash('Could not delete person') return redirect(url_for('showgroup', groupname=groupname))
def add_project_person(groupname): config = ConfigObj(path_to_conf()) section = 'group ' + groupname existing_members = config[section]['members'].split() if request.method == 'POST': if request.form['keynames'] != '0': existing_members = config[section]['members'].split() existing_members.append(request.form['keynames']) config[section]['members'] = ' '.join(existing_members) print config[section]['members'] try: config.write() flash('Added person') except: flash('Could not add person') return redirect(url_for('showgroup', groupname=groupname)) else: members = filter(lambda x: x not in existing_members, list_of_members()) if not members: flash('No new members') return redirect(url_for('showgroup', groupname=groupname)) return render_template('groupadd.html', members=members, group=groupname)
def index(): if not session.get('logged_in'): return redirect(url_for('login')) config = ConfigObj(path_to_conf()) return render_template('index.html', config=config)