

def mimetype_override(self):
    accept = self.request.headers.get('Accept', '')
    has_json_in_view = (self.program.view and self.program.view.can_render('json'))
    if ((accept == '*/*') and self.request.is_xhr and has_json_in_view):
        return 'application/json'
    if ((accept != '*/*') and (not accept.startswith('text/html'))):
        return accept
    return None

dataset/ETHPy150Open priestc/giotto/giotto/controllers/http.py HTTPController.mimetype_override/original