def get_formatted_string(self): formatted_params = [self._name] for param_name, param_value in self._parameters: if param_value is None: formatted_params.append(param_name) else: quoted_value = http_header_util.quote_if_necessary(param_value) formatted_params.append('%s=%s' % (param_name, quoted_value)) return '; '.join(formatted_params)
def format_extension(extension): """Format an ExtensionParameter object.""" formatted_params = [extension.name()] for param_name, param_value in extension.get_parameters(): if param_value is None: formatted_params.append(param_name) else: quoted_value = http_header_util.quote_if_necessary(param_value) formatted_params.append('%s=%s' % (param_name, quoted_value)) return '; '.join(formatted_params)
def format_extensions(extension_list): formatted_extension_list = [] for extension in extension_list: formatted_params = [extension.name()] for param_name, param_value in extension.get_parameters(): if param_value is None: formatted_params.append(param_name) else: quoted_value = http_header_util.quote_if_necessary(param_value) formatted_params.append('%s=%s' % (param_name, quoted_value)) formatted_extension_list.append('; '.join(formatted_params)) return ', '.join(formatted_extension_list)