all dirs must now go into COMPREHENSIVE_THEME_DIRS.
Move comprehensive theming setup section out of startup.py and into
settings files using new 'derived' functionality.
Add 'derive_settings' at the end of all top-level Django settings files.
Move validation of comprehensive theming settings into new apps.py
theming file.
Split theming code into code safe to run before settings are initialized
-and- after settings are initialized.
This makes it possible to refer to multiple book from a single app.
This also means that Open edX branches will be able to pass bok-choy
tests (at least if the books have already been built.)
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
[PERF-303] Integer XBlocks/XModules into the static asset pipeline.
This PR, based on hackathon work from Christina/Andy, implements a way to discover all installed XBlocks and XModules and to enumerate their public assets, then pulling them in during the collectstatic phase and hashing them. In turn, the methods for generating URLs to resources will then returned the hashed name for assets, allowing them to be served from nginx/CDNs, and cached heavily.
Comprehensive theming did not work with django templates (used by course wiki).
The reason it didn't work was that in order for the theme to work, theme template folder
has to be added to django template dirs setting *before* django startup.
After django startup, modifying `settings.DEFAULT_TEMPLATE_ENGINE['DIRS']` has no effect,
because at that point the template engine is already initialized with a copy of the
template dirs list.
Instead of running the theme startup code as an autostartup hook, we manually run it
*before* `django.setup()`. This is fine because theme startup code doesn't have to do
anything else besides modifying some settings and doesn't actually need django to be
initialized.
* The LMS now also monkey-patches
xmodule.x_module.descriptor_global_handler_url and
xmodule.x_module.descriptor_global_local_resource_url so that we can
get LMS XBlock URLs from the DescriptorSystem. That functionality is
needed in the block transforms collect() phase for certain XModules
like Video. For instance, say we want to generate the transcripts
URLs. The collect phase is run asynchronously, without a user context.
* The URL handler monkey-patching is now done in the startup.py files
for LMS and Studio. Studio used to do this in the import of
cms/djangoapps/contentstore/views/item.py. This was mostly just
because it seemed like a sane and consistent place to put it.
* LmsHandlerUrls was removed, its handler_url and local_resource_url
methods were moved to be top level functions. The only reason that
class existed seems to be to give a place to store course_id state,
and that can now be derived from the block location.
* To avoid the Module -> Descriptor ProxyAttribute magic that we do
(which explodes with an UndefinedContext error because there is no
user involved), when examining the block's handler method in
handler_url, I made a few changes:
** Check the .__class__ to see if the handler was defined, instead of the
block itself.
** The above required me to relax the check for _is_xblock_handler on the
function, since that will no longer be defined.
90% of this goes away when we kill XModules and do the refactoring we've
wanted to do for a while.
Modify Django's translation library, such that the gettext family of
functions return an empty string when attempting to translate a
falsey value. This overrides the default behavior [0]:
> It is convention with GNU gettext to include meta-data as the
> translation for the empty string.
This patch provides a holistic solution to replace the current piecemeal
approach [1][2].
Affected Methods:
- gettext
- ugettext
[0] https://docs.python.org/2.7/library/gettext.html#the-gnutranslations-class
[1] bad803e451
[2] https://github.com/edx/edx-platform/pull/4653