Example #1
0
def commonplace(request, repo):
    if repo not in settings.COMMONPLACE_REPOS:
        raise HttpResponseNotFound

    site_settings = {
        'persona_unverified_issuer': settings.BROWSERID_DOMAIN
    }

    ctx = {
        'repo': repo,
        'site_settings': site_settings,
        'flags': waffles(request),
    }

    # This is where the `build_{repo}.py` files get written to after
    # compiling and minifying our assets.
    site.addsitedir('/var/tmp/')

    try:
        # Get the `BUILD_ID` from `build_{repo}.py` and use that to
        # cache-bust the assets for this repo's CSS/JS minified bundles.
        module = 'build_%s' % repo
        ctx['BUILD_ID'] = importlib.import_module(module).BUILD_ID
    except (ImportError, AttributeError):
        # Either `build_{repo}.py` does not exist or `build_{repo}.py`
        # exists but does not contain `BUILD_ID`. Fall back to
        # `BUILD_ID_JS` which is written to `build.py` by jingo-minify.
        pass

    return jingo.render(request, 'commonplace/index.html', ctx)
Example #2
0
def commonplace(request, repo):
    if repo not in settings.COMMONPLACE_REPOS:
        raise HttpResponseNotFound

    site_settings = {'persona_unverified_issuer': settings.BROWSERID_DOMAIN}

    ctx = {
        'repo': repo,
        'site_settings': site_settings,
        'flags': waffles(request),
    }

    # This is where the `build_{repo}.py` files get written to after
    # compiling and minifying our assets.
    site.addsitedir('/var/tmp/')

    try:
        # Get the `BUILD_ID` from `build_{repo}.py` and use that to
        # cache-bust the assets for this repo's CSS/JS minified bundles.
        module = 'build_%s' % repo
        ctx['BUILD_ID'] = importlib.import_module(module).BUILD_ID
    except (ImportError, AttributeError):
        # Either `build_{repo}.py` does not exist or `build_{repo}.py`
        # exists but does not contain `BUILD_ID`. Fall back to
        # `BUILD_ID_JS` which is written to `build.py` by jingo-minify.
        pass

    return jingo.render(request, 'commonplace/index.html', ctx)
Example #3
0
def commonplace(request, repo, **kwargs):
    if repo not in settings.COMMONPLACE_REPOS:
        return HttpResponseNotFound
    site_settings = {
        'persona_unverified_issuer': settings.BROWSERID_DOMAIN
    }
    ctx = {
        'BUILD_ID': get_build_id(repo),
        'appcache': False,  #repo in settings.COMMONPLACE_REPOS_APPCACHED,
        'flags': waffles(request),
        'repo': repo,
        'site_settings': site_settings,
    }
    return jingo.render(request, 'commonplace/index.html', ctx)
Example #4
0
def commonplace(request, repo, **kwargs):
    if repo not in settings.COMMONPLACE_REPOS:
        return HttpResponseNotFound
    BUILD_ID = get_build_id(repo)
    site_settings = {'persona_unverified_issuer': settings.BROWSERID_DOMAIN}
    ctx = {
        'BUILD_ID': BUILD_ID,
        'appcache': repo in settings.COMMONPLACE_REPOS_APPCACHED,
        'flags': waffles(request),
        'repo': repo,
        'site_settings': site_settings,
    }
    if BUILD_ID:
        ctx.update(BUILD_ID_JS=BUILD_ID,
                   BUILD_ID_CSS=BUILD_ID,
                   BUILD_ID_IMG=BUILD_ID)
    return jingo.render(request, 'commonplace/index.html', ctx)
Example #5
0
def commonplace(request, repo):
    if repo not in settings.COMMONPLACE_REPOS:
        raise HttpResponseNotFound

    site_settings = {'persona_unverified_issuer': settings.BROWSERID_DOMAIN}

    ctx = {
        'repo': repo,
        'site_settings': site_settings,
        'flags': waffles(request),
    }

    try:
        # Get the `BUILD_ID` from `build_{repo}.py` and use that to
        # cache-bust the assets for this repo's CSS/JS minified bundles.
        module = 'media.%s.build_%s' % (repo, repo)
        ctx['BUILD_ID'] = importlib.import_module(module).BUILD_ID
    except ImportError:
        pass

    return jingo.render(request, 'commonplace/index.html', ctx)
Example #6
0
def commonplace(request, repo):
    if repo not in settings.COMMONPLACE_REPOS:
        raise HttpResponseNotFound

    site_settings = {
        'persona_unverified_issuer': settings.BROWSERID_DOMAIN
    }

    ctx = {
        'repo': repo,
        'site_settings': site_settings,
        'flags': waffles(request),
    }

    try:
        # Get the `BUILD_ID` from `build_{repo}.py` and use that to
        # cache-bust the assets for this repo's CSS/JS minified bundles.
        module = 'media.%s.build_%s' % (repo, repo)
        ctx['BUILD_ID'] = importlib.import_module(module).BUILD_ID
    except ImportError:
        pass

    return jingo.render(request, 'commonplace/index.html', ctx)