def _add_served_directory(cls, config, relative_path, config_var):
''' Add extra public/template directories to config. '''
import inspect
import os
assert config_var in ('extra_template_paths', 'extra_public_paths')
# we want the filename that of the function caller but they will
# have used one of the available helper functions
frame, filename, line_number, function_name, lines, index =\
inspect.getouterframes(inspect.currentframe())[2]
this_dir = os.path.dirname(filename)
absolute_path = os.path.join(this_dir, relative_path)
if absolute_path not in config.get(config_var, ''):
if config.get(config_var):
config[config_var] += ',' + absolute_path
else:
config[config_var] = absolute_path
评论列表
文章目录