コード例 #1
0
    def get_branding_for_host(cls, host):

        # our default branding
        branding = BRANDING.get('rapidpro.io')

        # override with site specific branding if we have that
        site_branding = BRANDING.get(host, None)
        if site_branding:
            branding = branding.copy()
            branding.update(site_branding)

        # stuff in the incoming host
        branding['host'] = host

        return branding
コード例 #2
0
    def get_branding_for_host(cls, host):

        # our default branding
        branding = BRANDING.get('rapidpro.io')

        # override with site specific branding if we have that
        site_branding = BRANDING.get(host, None)
        if site_branding:
            branding = branding.copy()
            branding.update(site_branding)

        # stuff in the incoming host
        branding['host'] = host

        return branding
コード例 #3
0
    def get_branding_for_host(cls, host):
        # ignore subdomains
        if len(host.split('.')) > 2:
            host = '.'.join(host.split('.')[-2:])

        # prune off the port
        if ':' in host:
            host = host[0:host.rindex(':')]

        # our default branding
        branding = BRANDING.get(HOSTNAME, BRANDING.get(DEFAULT_BRAND))

        # override with site specific branding if we have that
        site_branding = BRANDING.get(host, None)
        if site_branding:
            branding = branding.copy()
            branding.update(site_branding)

        # stuff in the incoming host
        branding['host'] = host

        return branding
コード例 #4
0
ファイル: middleware.py プロジェクト: thierhost/rapidpro
    def get_branding_for_host(cls, host):
        # ignore subdomains
        if len(host.split('.')) > 2:
            host = '.'.join(host.split('.')[-2:])

        # prune off the port
        if ':' in host:
            host = host[0:host.rindex(':')]

        # our default branding
        branding = BRANDING.get(HOSTNAME, BRANDING.get(DEFAULT_BRAND))

        # override with site specific branding if we have that
        site_branding = BRANDING.get(host, None)
        if site_branding:
            branding = branding.copy()
            branding.update(site_branding)

        # stuff in the incoming host
        branding['host'] = host

        return branding