def default_output_format(content_type='application/json', apply_globally=False, api=None):
 def decorator(formatter):
  formatter = hug.output_format.content_type(content_type)(formatter)
  if apply_globally:
   hug.defaults.output_format = formatter
  else:
   apply_to_api = (hug.API(api) if api else hug.api.from_object(formatter))
   apply_to_api.http.output_format = formatter
  return formatter
 return decorator

def default_output_format ( content_type = 'application/json' , apply_globally = False , api = None ) : def decorator ( formatter ) : formatter = hug . output_format . content_type ( content_type ) ( formatter ) if apply_globally : hug . defaults . output_format = formatter else : apply_to_api = ( hug . API ( api ) if api else hug . api . from_object ( formatter ) ) apply_to_api . http . output_format = formatter return formatter return decorator
a decorator that allows you to override the default output format for an api .