Skip to content

Commit

Permalink
fix: fix errors when the settings are not define
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanDavidBuitrago committed Jun 14, 2023
1 parent 2fd2fa9 commit f73e613
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 5 deletions.
5 changes: 3 additions & 2 deletions tutordistro/commands/enable_themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ def enable_themes() -> None:
repository = ThemeGitRepository()
enabler = ThemeEnabler(repository=repository)

for theme in config["DISTRO_THEMES"]:
enabler(settings=theme, tutor_root=directory, tutor_config=config)
if config.get("DISTRO_THEMES"):
for theme in config["DISTRO_THEMES"]:
enabler(settings=theme, tutor_root=directory, tutor_config=config)
2 changes: 2 additions & 0 deletions tutordistro/patches/cms-env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
USE_EOX_TENANT: True
{% if DISTRO_DEFAULT_SITE_THEME is defined or DISTRO_THEMES_NAME is defined %}
DEFAULT_SITE_THEME: "{{ DISTRO_DEFAULT_SITE_THEME | default(DISTRO_THEMES_NAME[0]) }}"
{%- endif -%}
2 changes: 2 additions & 0 deletions tutordistro/patches/lms-env
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
USE_EOX_TENANT: True
{% if DISTRO_DEFAULT_SITE_THEME is defined or DISTRO_THEMES_NAME is defined %}
DEFAULT_SITE_THEME: "{{ DISTRO_DEFAULT_SITE_THEME | default(DISTRO_THEMES_NAME[0]) }}"
{%- endif -%}
ENABLE_EOX_THEMING_DERIVE_WORKAROUND: True
SESSION_COOKIE_DOMAIN: ".{{ LMS_HOST|common_domain(CMS_HOST) }}"
2 changes: 2 additions & 0 deletions tutordistro/patches/openedx-cms-production-settings
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
{% endfor %}

COMPREHENSIVE_THEME_DIRS.remove('/openedx/themes')
{% if DISTRO_THEME_DIRS is defined %}
COMPREHENSIVE_THEME_DIRS.extend({{ DISTRO_THEME_DIRS }})
{%- endif -%}

################## EOX_THEMING ##################
from lms.envs.common import _make_mako_template_dirs # pylint: disable=import-error
Expand Down
2 changes: 2 additions & 0 deletions tutordistro/patches/openedx-common-assets-settings
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@
{% endfor %}

COMPREHENSIVE_THEME_DIRS.remove('/openedx/themes')
{% if DISTRO_THEME_DIRS is defined %}
COMPREHENSIVE_THEME_DIRS.extend({{ DISTRO_THEME_DIRS }})
{%- endif -%}
4 changes: 3 additions & 1 deletion tutordistro/patches/openedx-development-settings
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
{% endfor %}

COMPREHENSIVE_THEME_DIRS.remove('/openedx/themes')
{% if DISTRO_THEME_DIRS is defined %}
COMPREHENSIVE_THEME_DIRS.extend({{ DISTRO_THEME_DIRS }})
{%- endif -%}

################## EOX_THEMING ##################
if "EOX_THEMING_DEFAULT_THEME_NAME" in locals() and EOX_THEMING_DEFAULT_THEME_NAME:
Expand All @@ -21,6 +23,6 @@ if "EOX_THEMING_DEFAULT_THEME_NAME" in locals() and EOX_THEMING_DEFAULT_THEME_NA
derive_settings("lms.envs.devstack")
# EOL

{% if DISTRO_EXTRA_MIDDLEWARES %}
{% if DISTRO_EXTRA_MIDDLEWARES is defined %}
MIDDLEWARE.extend({{ DISTRO_EXTRA_MIDDLEWARES }})
{%- endif -%}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- if DISTRO_INSTALL_EDNX_REQUIREMENTS %}
{%- if DISTRO_INSTALL_EDNX_REQUIREMENTS is defined and DISTRO_INSTALL_EDNX_REQUIREMENTS %}
RUN pip install -r ./requirements/edunext/base.txt
{%- endif %}
{%- for pkg in iter_values_named(suffix="_DPKG") %}
Expand Down
4 changes: 4 additions & 0 deletions tutordistro/patches/openedx-dockerfile-pre-assets
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ RUN openedx-assets xmodule \
&& openedx-assets npm \
&& openedx-assets webpack --env=prod \
&& openedx-assets common
{% if DISTRO_THEMES_ROOT is defined %}
COPY --chown=app:app ./themes/ {{ DISTRO_THEMES_ROOT }}
{% endif %}
{% if DISTRO_THEME_DIRS is defined and DISTRO_THEMES_NAME is defined %}
RUN openedx-assets themes \
--theme-dirs {{ DISTRO_THEME_DIRS | join(' ') }} \
--themes {{ DISTRO_THEMES_NAME | join(' ') }} \
&& openedx-assets collect --settings=tutor.assets \
&& rdfind -makesymlinks true -followsymlinks true /openedx/staticfiles/
{% endif %}
4 changes: 3 additions & 1 deletion tutordistro/patches/openedx-lms-production-settings
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
{% endfor %}

COMPREHENSIVE_THEME_DIRS.remove('/openedx/themes')
{% if DISTRO_THEME_DIRS is defined %}
COMPREHENSIVE_THEME_DIRS.extend({{ DISTRO_THEME_DIRS }})
{%- endif -%}

################## EOX_THEMING ##################
if "EOX_THEMING_DEFAULT_THEME_NAME" in locals() and EOX_THEMING_DEFAULT_THEME_NAME:
Expand All @@ -21,6 +23,6 @@ if "EOX_THEMING_DEFAULT_THEME_NAME" in locals() and EOX_THEMING_DEFAULT_THEME_NA
derive_settings("lms.envs.production")
# EOL

{% if DISTRO_EXTRA_MIDDLEWARES %}
{% if DISTRO_EXTRA_MIDDLEWARES is defined %}
MIDDLEWARE.extend({{ DISTRO_EXTRA_MIDDLEWARES }})
{%- endif -%}

0 comments on commit f73e613

Please sign in to comment.