Skip to content

Commit

Permalink
feat: override get_dirs method
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon authored and bra-i-am committed Nov 17, 2023
1 parent 43ce037 commit acdfab7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions eox_theming/theming/template_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class EoxThemeTemplateLoader(OpenedxThemeLoader):
See: openedx.core.djangoapps.theming.template_loaders.py
"""

def __init__(self, *args):
MakoLoader.__init__(self, EoxThemeFilesystemLoader(*args))

Expand Down Expand Up @@ -79,3 +80,17 @@ def get_grandparent_theme_template_sources():
return grandparent_theme.template_dirs

return template_paths

def get_dirs(self):
"""This overrides the default get_dirs method from django
https://github.com/django/django/blob/3.2/django/template/loaders/filesystem.py#L18
due to the django implementation depends on the initialization process that is performed by
the sub-class ThemeFilesystemLoader
https://github.com/eduNEXT/edunext-platform/blob/open-release/maple.master/openedx/core/djangoapps/theming/template_loaders.py#L30
however that implementation is cached and doesn't allow to get the right values during the execution time.
Finally this returns the result of the `get_theme_template_sources` method
https://github.com/eduNEXT/edunext-platform/blob/master/openedx/core/djangoapps/theming/template_loaders.py#L39
instead of using the cached values of self.dirs on runtime.
"""
return ThemeFilesystemLoader.get_theme_template_sources()

0 comments on commit acdfab7

Please sign in to comment.