<s> import os <EOL> from django . template . loaders . filesystem import Loader as FileSystemLoader <EOL> from accounts . models import get_template <EOL> import settings <EOL> class Loader ( FileSystemLoader ) : <EOL> def get_template_sources ( self , template_name , template_dirs = None ) : <EOL> if not template_dirs : <EOL> template = settings . DEFAULT_TEMPLATE <EOL> request = getattr ( settings , '<STR_LIT>' , None ) <EOL> template_dirs = settings . TEMPLATE_DIRS <EOL> if request : <EOL> template = get_template ( request ) <EOL> template_dirs = [ os . path . join ( path , template ) for path in template_dirs ] <EOL> template_dirs = tuple ( template_dirs ) <EOL> return super ( Loader , self ) . get_template_sources ( template_name , template_dirs ) </s>
