Create a dictionary of parameters used in URLs for this model.
344057
def get_url_parameters(self):
        """"""
        url_fields = {}
        for field in self.url_fields:
            url_fields[field] = getattr(self, field)
        return url_fields
494126
def params(self):
        
        params = odict([])
        for key,model in self.models.items():
            params.update(model.params)
        return params
135275
def urlparse(d, keys=None):
    """"""

    d = d.copy()

    if keys is None:
        keys = d.keys()

    for key in keys:
        d[key] = _urlparse(d[key])

    return d
257648
def _load_parameters(self):
        ""
        parameters = self._get_json('allparam/s')
        data = {}
        for parameter in parameters:    # There is a case-chaos in the DB
            data[parameter['Name'].lower()] = parameter
        self._parameters = ParametersContainer(data)
1189623
def _serialize_parameters(parameters):
        

        for key, value in parameters.items():
            if isinstance(value, bool):
                parameters[key] = "true" if value else "false"
            elif isinstance(value, dict):
                parameters[key] = "|".join(
                    ("%s:%s" % (k, v) for k, v in value.items()))
            elif isinstance(value, (list, tuple)):
                parameters[key] = "|".join(value)
        return parameters
1343378
def generate_item_urls(self):
        """"""
        item_urls = {}
        for i in self.dataset.identifiers:
            relpath = self.dataset.item_properties(i)["relpath"]
            url = self.generate_url("data/" + relpath)
            item_urls[i] = url
        return item_urls
624643
def _parse_parameters(self, resource, params):
        '''
        '''
        # remove params from resource URI (needed for paginated stuff)
        parsed_uri = urlparse(resource)
        qs = parsed_uri.query
        resource = urlunparse(parsed_uri._replace(query=''))
        prms = {}
        for tup in parse_qsl(qs):
            prms[tup[0]] = tup[1]

        # params supplied to self.get() override parsed params
        for key in params:
            prms[key] = params[key]
        return resource, prms
112087
def parameters_from_model(parameters_model):
        
        parameters = {}
        for p in parameters_model:
            if p.is_function:
                code, defaults, closure = pickle.loads(p.value)
                parameters[p.key] = func_load(code, defaults, closure, globs=globals())
            elif p.is_set:
                parameters[p.key] = set(p.value)
            else:
                parameters[p.key] = p.value
        return parameters
664639
def params(self):
        
        if self._GETPOST is None:
            self._GETPOST = MultiDict(self.GET)
            self._GETPOST.update(dict(self.POST))
        return self._GETPOST
544324
def parameters(self, parameters):
        """"""
        # pylint: disable=attribute-defined-outside-init
        self._parameters = NocaseDict()
        if parameters:
            try:
                # This is used for iterables:
                iterator = parameters.items()
            except AttributeError:
                # This is used for dictionaries:
                iterator = parameters
            for item in iterator:
                if isinstance(item, CIMParameter):
                    key = item.name
                    value = item
                elif isinstance(item, tuple):
                    key, value = item
                else:
                    raise TypeError(
                        _format("Input object for parameters has invalid item "
                                "in iterable: {0!A}", item))
                self.parameters[key] = value
811513
def get_ordered_params(url):
        

        if url not in URLHelper.__cache:
            URLHelper.__cache[url] = urlparse(url)

        params = URLHelper.query_string_to_dict(URLHelper.__cache[url].query)

        return OrderedDict(sorted(params.items()))
1121187
def _build_list_params(param_name, key, values):
        """"""
        params = {}
        if hasattr(values, '__iter__'):
            index = 0
            for value in values:
                params[str(param_name) + '[' + str(index) + '].' + str(key)] = str(value)
                index += 1
        else:
            params[str(param_name) + '[0].' + str(key)] = str(values)
        return params
1194549
def __append_url_params(self, url, params):
    """"""
    url_parts = list(urlparse(url))
    query = dict(parse_qsl(url_parts[4]))
    query.update(params)
    url_parts[4] = urlencode(query)

    return urlunparse(url_parts)
144026
def _create_query_string(params):
        
        parameters = params or {}

        for param, value in parameters.items():
            param_value = str(value).lower() if isinstance(value, bool) else value
            parameters[param] = param_value

        return urlencode(parameters)
13096
def parameters_dict(self):
        
        d = {}
        for k, v in self.__dict__.items():
            if not k.startswith("_"):
                d[k] = v
        return d
667470
def urlencode(params):
    """"""

    # Not doing duck typing here. Will make debugging easier.
    if not isinstance(params, dict):
        raise TypeError("Only dicts are supported.")

    params = flatten(params)

    url_params = OrderedDict()
    for param in params:
        value = param.pop()

        name = parametrize(param)
        if isinstance(value, (list, tuple)):
            name += "[]"

        url_params[name] = value

    return urllib_urlencode(url_params, doseq=True)
767110
def _build_url(self, shorten=True):
        """"""
        self.url = URL_FORMAT.format(*self._get_url_params(shorten=shorten))