<s> import os <EOL> from flask import send_from_directory , current_app , request <EOL> from flask . ext . security import roles_accepted <EOL> from lingobarter . core . views import ( <EOL> ContentList , <EOL> ) <EOL> @ roles_accepted ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def template_files ( filename ) : <EOL> template_path = os . path . join ( current_app . root_path , <EOL> current_app . template_folder ) <EOL> return send_from_directory ( template_path , filename ) <EOL> def media ( filename ) : <EOL> return send_from_directory ( current_app . config . get ( '<STR_LIT>' ) , filename ) <EOL> def static_from_root ( ) : <EOL> return send_from_directory ( current_app . static_folder , request . path [ <NUM_LIT:1> : ] ) <EOL> def configure ( app ) : <EOL> app . add_lingobarter_url_rule ( '<STR_LIT>' , view_func = media ) <EOL> app . add_lingobarter_url_rule ( '<STR_LIT>' , <EOL> view_func = template_files ) <EOL> for filepath in app . config . get ( '<STR_LIT>' , [ ] ) : <EOL> app . add_lingobarter_url_rule ( filepath , view_func = static_from_root ) <EOL> app . add_lingobarter_url_rule ( <EOL> '<STR_LIT:/>' , <EOL> view_func = ContentList . as_view ( '<STR_LIT>' ) <EOL> ) </s>
