Exemplo n.º 1
0
 def get(self):
     speakers = Speaker.get_all()
     speaker_list = []
     for speaker in speakers:
         speaker_list.append(speaker.to_json_dict('full_name', 'email',
             'is_starred', 'is_active', 'is_deleted', 'when_created'))
     response = json.dumps(speaker_list)
     self.response.out.write(response)
Exemplo n.º 2
0
    def get(self, id = None):
	request = self.wsgi_request
	response = self.wsgi_response
	c = self.context
	response.headers['content-type'] = 'application/json'

	if id is None:
	    #get all the speakers
	    speakers = [x.to_json(encode = False) for x in Speaker.get_all()]
	    self.set_body(json.dumps(speakers))
	else:
	    speaker = Speaker.get(id)
	    self.set_body(speaker.to_json())
	return self.render()