def process_context_1(jinja2_env_mock,
                   asset_manager_mock_wraps_virtual,
                   root_namespace_store):
    return ProcessContext({},
                   jinja2_env_mock,
                   asset_manager_mock_wraps_virtual,
                   root_namespace_store)
Пример #2
0
def entry_point_content(context, request):
    entry_point = request.registry.getUtility(IEntryPoint, request.subpath[0])
    vam = VirtualAssetManager()
    process_view(request.registry,
                 config={},
                 proc_context=ProcessContext({}, context.template_env, vam),
                 entry_point=entry_point)

    logger.critical("v = %r", vam.assets[entry_point].content)
    # (v,) = vam.asset_content.values()

    return Response(vam.assets[entry_point].content)
Пример #3
0
def initialize(args, registry, config):
    template_env = registry.queryUtility(IJinja2Environment, 'template-env')
    assert template_env
    # specify path
    asset_mgr: AbstractAssetManager
    if args.virtual_assets:
        asset_mgr = VirtualAssetManager()
    else:
        # fixme hardcoded here.
        asset_mgr = FileAssetManager("build/assets", mkdir=True)
    proc_context = ProcessContext(config, template_env, asset_mgr)
    registry.registerUtility(proc_context)
    return asset_mgr, proc_context, template_env
Пример #4
0
def entry_points_json(context, request):
    utilities_for = request.entry_points
    eps = list(map(lambda x: x[1], utilities_for))
    vam = VirtualAssetManager()
    for ep in eps:
        process_view(request.registry,
                     config={},
                     proc_context=ProcessContext({}, context.template_env,
                                                 vam),
                     entry_point=ep)
        ep.content = vam.assets[ep].content
    s = EntryPointSchema()

    return Response(json.dumps({'entry_points': s.dump(eps, many=True)}))
Пример #5
0
def process_context(jinja2_env, asset_manager_mock_wraps_virtual):
    # fix me should not be none!
    return ProcessContext({}, jinja2_env, asset_manager_mock_wraps_virtual,
                          None)
 def _make_process_context(settings, template_env, asset_manager):
     return ProcessContext(settings, template_env, asset_manager)
def process_context(jinja2_env, asset_manager_mock):
    return ProcessContext({}, jinja2_env, asset_manager_mock)