Example #1
0
        def _decorated(*args, **kwargs):        # pylint: disable=missing-docstring
            with override_settings(COMP_THEME_DIR=theme_dir, **changes['settings']):
                with edxmako.save_lookups():
                    for template_dir in changes['mako_paths']:
                        edxmako.paths.add_lookup('main', template_dir, prepend=True)

                    return func(*args, **kwargs)
Example #2
0
 def _decorated(*args, **kwargs):        # pylint: disable=missing-docstring
     with override_settings(COMPREHENSIVE_THEME_DIR=theme_dir, **changes['settings']):
         default_engine = Engine.get_default()
         dirs = default_engine.dirs[:]
         with edxmako.save_lookups():
             for template_dir in changes['template_paths']:
                 edxmako.paths.add_lookup('main', template_dir, prepend=True)
                 dirs.insert(0, template_dir)
             with patch.object(default_engine, 'dirs', dirs):
                 return func(*args, **kwargs)
Example #3
0
 def _decorated(*args, **kwargs):        # pylint: disable=missing-docstring
     with override_settings(COMPREHENSIVE_THEME_DIR=theme_dir, **changes['settings']):
         default_engine = Engine.get_default()
         dirs = default_engine.dirs[:]
         with edxmako.save_lookups():
             for template_dir in changes['template_paths']:
                 edxmako.paths.add_lookup('main', template_dir, prepend=True)
                 dirs.insert(0, template_dir)
             with patch.object(default_engine, 'dirs', dirs):
                 return func(*args, **kwargs)
Example #4
0
def with_edx_domain_context(is_edx_domain):
    """
    A function to run a test as if request originated from edX domain or not.

    Arguments:
        is_edx_domain (bool): are we an edX domain or not?

    """
    if is_edx_domain:
        changes = comprehensive_theme_changes(EDX_THEME_DIR)
        with override_settings(COMPREHENSIVE_THEME_DIR=EDX_THEME_DIR, **changes['settings']):
            with edxmako.save_lookups():
                for template_dir in changes['template_paths']:
                    edxmako.paths.add_lookup('main', template_dir, prepend=True)

                yield
    else:
        yield
Example #5
0
def with_edx_domain_context(is_edx_domain):
    """
    A function to run a test as if request originated from edX domain or not.

    Arguments:
        is_edx_domain (bool): are we an edX domain or not?

    """
    if is_edx_domain:
        changes = comprehensive_theme_changes(EDX_THEME_DIR)
        with override_settings(COMPREHENSIVE_THEME_DIR=EDX_THEME_DIR, **changes['settings']):
            with edxmako.save_lookups():
                for template_dir in changes['template_paths']:
                    edxmako.paths.add_lookup('main', template_dir, prepend=True)

                yield
    else:
        yield