Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
def get_file_contents(filename):
    base_path = tinymce.settings.JS_ROOT
    if settings.DEBUG and settings.STATIC_ROOT:
        from django.contrib.staticfiles import finders
        base_path = finders.find('tiny_mce')

    try:
        f = open(os.path.join(base_path, filename))
        try:
            return f.read()
        finally:
            f.close()
    except IOError:
        return ""

this is one of the django-tinymce files, so if you are in debug mode, it will use the root of django-tinymce to load the js files.