def put(self, key): '''Adds a Character to a Party. ''' _trace = TRACE+'APIParties:: put() ' logging.info(_trace) _party = db.get(key) if _party is not None and _party.class_name() == 'Party': try: character_key = self.request.get('character_key') except AttributeError: r = API400 r[MSG] = 'Missing \'character_key\' parameter.' character = db.get(character_key) if character is not None and character.class_name() == 'Character': _party = party.updateJSONParty(party, character) r = API200 r[MSG] = 'The party grows stronger!' r[_party.class_name()] = _party else: r = API404 r[MSG] = 'Character not found for key '+character_key+' .' r = API200 r[MSG] = 'Adventure a party makes.' r[_party.class_name()] = party.getJSONParty(party) else: r = API404 r[MSG] = 'Party not found for key '+key+' .' return self.response.out.write(simplejson.dumps(r))
def put(self, key): """Adds a Character to a Party. """ _trace = TRACE + "APIParties:: put() " logging.info(_trace) _party = db.get(key) if _party is not None and _party.class_name() == "Party": try: character_key = self.request.get("character_key") except AttributeError: r = API400 r[MSG] = "Missing 'character_key' parameter." character = db.get(character_key) if character is not None and character.class_name() == "Character": _party = party.updateJSONParty(party, character) r = API200 r[MSG] = "The party grows stronger!" r[_party.class_name()] = _party else: r = API404 r[MSG] = "Character not found for key " + character_key + " ." r = API200 r[MSG] = "Adventure a party makes." r[_party.class_name()] = party.getJSONParty(party) else: r = API404 r[MSG] = "Party not found for key " + key + " ." return self.response.out.write(simplejson.dumps(r))
def get(self, key): '''Returns the Party. ''' _trace = TRACE+'APIParties:: get() ' logging.info(_trace) _party = db.get(key) if _party is not None: if _party.class_name() in ['PlayerParty', 'NonPlayerParty']: r = API200 r[MSG] = 'Adventure or Destruction a party makes.' r[_party.class_name()] = party.getJSONParty(_party) else: r = API404 r[MSG] = 'Party not found for key '+key+' .' return self.response.out.write(simplejson.dumps(r))
def get(self, key): """Returns the Party. """ _trace = TRACE + "APIParties:: get() " logging.info(_trace) _party = db.get(key) if _party is not None: if _party.class_name() in ["PlayerParty", "NonPlayerParty"]: r = API200 r[MSG] = "Adventure or Destruction a party makes." r[_party.class_name()] = party.getJSONParty(_party) else: r = API404 r[MSG] = "Party not found for key " + key + " ." return self.response.out.write(simplejson.dumps(r))
def get(self, player_key, monster_party_key): _trace = TRACE+'CharacterAttackHandler.get() ' logging.info(_trace) _character = db.get(player_key) _party = db.get(monster_party_key) monster_party = party.getJSONParty(_party) _player = character.getJSONPlayer(_character) party_key = str(_character.party.key()) user = users.get_current_user() template_values = { 'player': _player, 'monster_party': monster_party, 'party_key': party_key, 'user': user } generate(self, 'character_attack.html', template_values)