eskp.py
changeset 246 591429b20748
parent 245 b209c747888e
child 247 6a8a901ba550
equal deleted inserted replaced
245:b209c747888e 246:591429b20748
    12 from config import LANGUAGES
    12 from config import LANGUAGES
    13 
    13 
    14 LANGUAGE_SELECTED = "de"
    14 LANGUAGE_SELECTED = "de"
    15 #ToDo after engelish is implemented set LANGUAGE_SELECTED = None
    15 #ToDo after engelish is implemented set LANGUAGE_SELECTED = None
    16 
    16 
       
    17 # We need the path of this file to find templates to translate
       
    18 ESKP_PATH = os.path.dirname(os.path.abspath(__file__))
       
    19 
    17 app = Flask(__name__)
    20 app = Flask(__name__)
    18 babel = Babel(app)
    21 babel = Babel(app)
    19 
    22 
    20 app.config['BABEL_DEFAULT_LOCALE'] = 'de'
    23 app.config['BABEL_DEFAULT_LOCALE'] = 'de'
    21 
    24 
    22 
    25 
    23 def get_content(filename, overrides=None):
    26 def get_content(filename, overrides=None):
    24     content = u""
    27     content = u""
       
    28     filename = os.path.join(ESKP_PATH, filename)
    25     if os.path.isfile(filename):
    29     if os.path.isfile(filename):
    26         with codecs.open(filename, 'r', 'utf-8') as f:
    30         with codecs.open(filename, 'r', 'utf-8') as f:
    27             rst_data = f.read()
    31             rst_data = f.read()
    28         f.close()
    32         f.close()
    29         content = publish_parts(rst_data, writer_name='html', settings_overrides=overrides)['html_body']
    33         content = publish_parts(rst_data, writer_name='html', settings_overrides=overrides)['html_body']
Impressum Datenschutzerklärung