def update_physical_desc(name): pc = Character(name) pc.update({ "weight": request.form.get('weight'), "height": "%s\" %s'" % divmod(int(request.form.get('height')), 12), "gender": request.form.get('gender'), "age": request.form.get('age'), "alignment": request.form.get('alignment'), "eyes": request.form.get('eyes'), "hair": request.form.get('hair'), "languages": request.form.getlist("languages") }) return redirect(url_for('show_pc', name=name))
def update_race(name): pc = Character(name) updates = { "race": request.form.get('race'), "traits": request.form.getlist("traits") } race_data = pf_data['races'][request.form.get('race')] if "choice" in race_data['modifiers']: mod = request.form.get("modifier") updates[mod] = int(pc.attributes[mod]) + 2 else: for modifier, value in race_data['modifiers'].iteritems(): updates[modifier] = int(pc.attributes[modifier]) + int(value) pc.update(updates) return redirect(url_for('physical_desc', name=name))