def post(self): if self.params.characters: party = Party.get_current() characters = [] for character in self.params.characters: c_id = character.get('id') clean(character) db_char = c_id and Character.get(c_id) or Character(party=party) for k, v in character.iteritems(): setattr(db_char, k, extract(k, v)) db_char.put() characters.append(db_char) self.write(json.dumps([c.to_dict() for c in characters])) else: self.write(json.dumps([]))
def get(self): party = Party.get_current() self.render('encounter.html', combatants=json.dumps([c.to_dict() for c in party.characters]))