コード例 #1
0
ファイル: helpers.py プロジェクト: pawelniewie/5groszy.pl
def url_for(*args, **kwargs):
    params = kwargs.get('params')
    if params:
        del kwargs['params']
        for k in params.iterkeys():
            kwargs[k] = params.getall(k)
    return routes_url_for(*args, **kwargs)
コード例 #2
0
ファイル: helpers.py プロジェクト: nickstenning/openspending
def url_for(*args, **kwargs):
    """
    Overwrite routes url_for so that we can set the protocol based on
    the config (in case Varnish or other software messes with the headers
    """

    # Since Varnish or other software can mess with the headers and
    # cause us to lose the protocol of the request we need to fetch it
    # from a config and set it
    protocol = config.get('openspending.enforced_protocol', None)
    if protocol:
        kwargs.update({'protocol':protocol})
    return routes_url_for(*args, **kwargs)
コード例 #3
0
ファイル: helpers.py プロジェクト: serchaos/openspending
def url_for(*args, **kwargs):
    """
    Overwrite routes url_for so that we can set the protocol based on
    the config (in case Varnish or other software messes with the headers
    """

    # Since Varnish or other software can mess with the headers and
    # cause us to lose the protocol of the request we need to fetch it
    # from a config and set it
    protocol = config.get('openspending.enforced_protocol', None)
    if protocol:
        kwargs.update({'protocol': protocol})
    return routes_url_for(*args, **kwargs)