

def _can_parse(self, content_type):
    "Whether this navigator can parse the given content-type.\n        Checks that the content_type matches one of the types specified\n        in the 'Accept' header of the request, if supplied.\n        If not supplied, matches against the default"
    (content_type, content_subtype, content_param) = utils.parse_media_type(content_type)
    for accepted in self.headers.get('Accept', self.DEFAULT_CONTENT_TYPE).split(','):
        (type, subtype, param) = utils.parse_media_type(accepted)
        matched = ((type == content_type) and (subtype == content_subtype) and ((param == content_param) or (not (param and content_param))))
        if matched:
            return True
    return False

dataset/ETHPy150Open deontologician/restnavigator/restnavigator/halnav.py HALNavigatorBase._can_parse/original