Example #1
0
    def get_context():
        c = {}
        for processor in get_standard_processors():
            c.update(processor(request))

        if context is not None:
            c.update(context.copy())
        return c
Example #2
0
    def get_context():
        c = {}
        for processor in get_standard_processors():
            c.update(processor(request))

        if context is not None:
            c.update(context.copy())
        return c
Example #3
0
def render_xml_to_string(request, template, context={}):
    if not jingo._helpers_loaded:
        jingo.load_helpers()

    for processor in get_standard_processors():
        context.update(processor(request))

    template = xml_env.get_template(template)
    return template.render(context)
Example #4
0
def render_xml_to_string(request, template, context=None):
    if context is None:
        context = {}
    if not jingo._helpers_loaded:
        jingo.load_helpers()

    for processor in get_standard_processors():
        context.update(processor(request))

    template = xml_env.get_template(template)
    return template.render(context)
Example #5
0
def manifest(request):
    ctx = RequestContext(request)
    for processor in get_standard_processors():
        ctx.update(processor(request))
    data = {
        'name': getattr(settings, 'WEBAPP_MANIFEST_NAME',
                        'Firefox Marketplace'),
        'description': 'The Firefox Marketplace',
        'developer': {
            'name': 'Mozilla',
            'url': 'http://mozilla.org',
        },
        'icons': {
            # Using the default addon image until we get a marketplace logo.
            '128': media(ctx, 'img/mkt/logos/128.png'),
            '64': media(ctx, 'img/mkt/logos/64.png'),
            '32': media(ctx, 'img/mkt/logos/32.png'),
        },
        'activities': {
            'marketplace-app': {
                'href': '/'
            },
            'marketplace-app-rating': {
                'href': '/'
            },
            'marketplace-category': {
                'href': '/'
            },
            'marketplace-search': {
                'href': '/'
            },
        }
    }
    if get_carrier():
        data['launch_path'] = urlparams('/', carrier=get_carrier())

    manifest_content = json.dumps(data)
    manifest_etag = hashlib.sha256(manifest_content).hexdigest()

    @etag(lambda r: manifest_etag)
    def _inner_view(request):
        response = HttpResponse(
            manifest_content,
            content_type='application/x-web-app-manifest+json')
        return response

    return _inner_view(request)
Example #6
0
def manifest(request):
    ctx = RequestContext(request)
    for processor in get_standard_processors():
        ctx.update(processor(request))
    data = {
        'name': getattr(settings, 'WEBAPP_MANIFEST_NAME',
                        'Firefox Marketplace'),
        'description': 'The Firefox Marketplace',
        'developer': {
            'name': 'Mozilla',
            'url': 'http://mozilla.org',
        },
        'icons': {
            # Using the default addon image until we get a marketplace logo.
            '128': media(ctx, 'img/mkt/logos/128.png'),
            '64': media(ctx, 'img/mkt/logos/64.png'),
            '32': media(ctx, 'img/mkt/logos/32.png'),
        },
        'activities': {
            'marketplace-app': {'href': '/'},
            'marketplace-app-rating': {'href': '/'},
            'marketplace-category': {'href': '/'},
            'marketplace-search': {'href': '/'},
        }
    }
    if get_carrier():
        data['launch_path'] = urlparams('/', carrier=get_carrier())

    manifest_content = json.dumps(data)
    manifest_etag = hashlib.sha256(manifest_content).hexdigest()

    @etag(lambda r: manifest_etag)
    def _inner_view(request):
        response = HttpResponse(
            manifest_content,
            content_type='application/x-web-app-manifest+json')
        return response

    return _inner_view(request)