pymove3d.py
changeset 162 90e47d2a2c40
parent 161 cb62df6e4e77
child 163 c87c8fe6c9bf
     1.1 --- a/pymove3d.py	Sun Jan 19 11:40:20 2014 +0100
     1.2 +++ b/pymove3d.py	Sun Jan 19 12:12:17 2014 +0100
     1.3 @@ -26,6 +26,15 @@
     1.4  
     1.5  app.config['BABEL_DEFAULT_LOCALE'] = 'de'
     1.6  
     1.7 +def get_content(filename):
     1.8 +    content = u""
     1.9 +    if os.path.isfile(filename):
    1.10 +        with codecs.open(filename, 'r', 'utf-8') as f:
    1.11 +            rst_data = f.read()
    1.12 +        f.close()
    1.13 +        content = publish_parts(rst_data, writer_name='html')['html_body']
    1.14 +    return content
    1.15 +
    1.16  def get_topmenue():
    1.17      menue =  [('/competition', _(u'Competition')),
    1.18                ('/task', _(u'Task')),
    1.19 @@ -71,7 +80,9 @@
    1.20  
    1.21  @app.route("/competition")
    1.22  def competition():
    1.23 -    return render_template(get_locale() + "/competition.html", act="competition")
    1.24 +    filename = os.path.join("templates", get_locale(), "rst", "competition.rst")
    1.25 +    content = get_content(filename)
    1.26 +    return render_template("/competition.html", act="competition", content=content)
    1.27  
    1.28  @app.route("/task")
    1.29  def task():
    1.30 @@ -105,15 +116,11 @@
    1.31      return render_template(get_locale() + "/archive/competitions/2014/index.html", 
    1.32                             act="coursematerial")
    1.33  
    1.34 +
    1.35  @app.route("/dates")
    1.36  def dates():
    1.37 -    content = u""
    1.38      filename = os.path.join("templates", get_locale(), "rst", "dates.rst")
    1.39 -    if os.path.isfile(filename):
    1.40 -        with codecs.open(filename, 'r', 'utf-8') as f:
    1.41 -            rst_data = f.read()
    1.42 -        f.close()
    1.43 -        content = publish_parts(rst_data, writer_name='html')['html_body']
    1.44 +    content = get_content(filename)
    1.45      return render_template("/dates.html",
    1.46                             act="dates", content=content)
    1.47  
Impressum Datenschutzerklärung