2. Update COMPREHNSIVE_THEME_DIR to COMPREHENSIVE_THEME_DIRS 3. Update paver commands to support multi theme dirs 4. Updating template loaders 5. Add ENABLE_COMPREHENSIVE_THEMING flag to enable or disable theming via settings 6. Update tests 7. Add backward compatibility for COMPREHEHNSIVE_THEME_DIR
22 lines
568 B
Python
22 lines
568 B
Python
"""
|
|
Middleware for theming app
|
|
|
|
Note:
|
|
This middleware depends on "django_sites_extensions" app
|
|
So it must be added to INSTALLED_APPS in django settings files.
|
|
"""
|
|
|
|
from openedx.core.djangoapps.theming.models import SiteTheme
|
|
|
|
|
|
class CurrentSiteThemeMiddleware(object):
|
|
"""
|
|
Middleware that sets `site_theme` attribute to request object.
|
|
"""
|
|
|
|
def process_request(self, request):
|
|
"""
|
|
fetch Site Theme for the current site and add it to the request object.
|
|
"""
|
|
request.site_theme = SiteTheme.get_theme(request.site)
|