Files
edx-platform/common/djangoapps/edxmako/startup.py
Chris Rossi 0a1ed11daa Make mako template lookups pluggable.
This code adds the ability to add Mako template lookup directories on
the fly, allowing third party add-ons to contribute their own Mako templates.
A new API function for registering Mako templates is introduced::

    from edxmako import add_lookup

    add_lookup('main', '/path/to/templates')

    # Or, specify a package to lookup using pkg_resources.  This will
    # add the 'templates' directory inside the current package:
    add_lookup('main', 'templates', package=__name__)
2014-01-31 13:55:36 -05:00

16 lines
360 B
Python

"""
Initialize the mako template lookup
"""
from django.conf import settings
from . import add_lookup
def run():
"""
Setup mako lookup directories.
"""
template_locations = settings.MAKO_TEMPLATES
for namespace, directories in template_locations.items():
for directory in directories:
add_lookup(namespace, directory)