def server_box_icon(self): ID = self.request.get('ID') if ID: box = Box.get_by_urlsafe_key(ID) if box: self.response.headers['Content-Type'] = 'image/png' self.response.out.write(box.icon) return self.error(404)
def get_box(self, request): ''' Retrieve a single box for a specific product and user ''' # fetch the product and user based on the request box = Box.get_by_urlsafe_key(request.boxKey) if not box: message = 'No box with the key "%s" exists.' % request.boxKey raise endpoints.NotFoundException(message) return BoxHelper.create_box(box)