def check_accept(*types):
 def decorator(f):
  @functools.wraps(f)
  def decorated_function(req):
   if req.accept:
    best_match = req.accept.best_match(types)
    if (not best_match):
     type_string = ', '.join(types)
     raise webob.exc.HTTPNotAcceptable((_('Only %(type)s is provided') % {'type': type_string}), json_formatter=json_error_formatter)
   return f(req)
  return decorated_function
 return decorator

def check_accept ( * types ) : def decorator ( f ) : @ functools . wraps ( f ) def decorated_function ( req ) : if req . accept : best_match = req . accept . best_match ( types ) if ( not best_match ) : type_string = ', ' . join ( types ) raise webob . exc . HTTPNotAcceptable ( ( _ ( 'Only %(type)s is provided' ) % { 'type' : type_string } ) , json_formatter = json_error_formatter ) return f ( req ) return decorated_function return decorator
if accept is set explicitly .