<s> from desktop . lib import apputil <EOL> import os <EOL> from django . template . loaders import app_directories <EOL> import logging <EOL> import sys <EOL> from django . template import TemplateDoesNotExist <EOL> APP_REMAP = { <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> def load_template_source ( name , dirs = [ ] ) : <EOL> app = apputil . get_current_app ( ) <EOL> if not app : <EOL> logging . info ( "<STR_LIT>" % name ) <EOL> raise TemplateDoesNotExist ( "<STR_LIT>" + name ) <EOL> if app in APP_REMAP : <EOL> app = APP_REMAP [ app ] <EOL> __import__ ( app ) <EOL> app_module = sys . modules [ app ] <EOL> app_dir = os . path . dirname ( app_module . __file__ ) <EOL> default_dir = os . path . join ( app_dir , '<STR_LIT>' ) <EOL> return app_directories . load_template_source ( name , [ default_dir ] ) <EOL> load_template_source . is_usable = True </s>
