pymove3d.py
changeset 161 cb62df6e4e77
parent 160 e4f16be8b5b0
child 162 90e47d2a2c40
equal deleted inserted replaced
160:e4f16be8b5b0 161:cb62df6e4e77
    11 from flask.ext.babel import Babel
    11 from flask.ext.babel import Babel
    12 
    12 
    13 from config import LANGUAGES
    13 from config import LANGUAGES
    14 from sayings import get_saying
    14 from sayings import get_saying
    15 from jinja2 import Environment, FileSystemLoader
    15 from jinja2 import Environment, FileSystemLoader
       
    16 
       
    17 import codecs
       
    18 from docutils.core import publish_parts
       
    19 
    16 
    20 
    17 LANGUAGE_SELECTED = "de"
    21 LANGUAGE_SELECTED = "de"
    18 #ToDo after engelish is implemented set LANGUAGE_SELECTED = None
    22 #ToDo after engelish is implemented set LANGUAGE_SELECTED = None
    19 
    23 
    20 app = Flask(__name__)
    24 app = Flask(__name__)
   101     return render_template(get_locale() + "/archive/competitions/2014/index.html", 
   105     return render_template(get_locale() + "/archive/competitions/2014/index.html", 
   102                            act="coursematerial")
   106                            act="coursematerial")
   103 
   107 
   104 @app.route("/dates")
   108 @app.route("/dates")
   105 def dates():
   109 def dates():
   106     return render_template(get_locale() + "/dates.html",
   110     content = u""
   107                            act="dates")
   111     filename = os.path.join("templates", get_locale(), "rst", "dates.rst")
       
   112     if os.path.isfile(filename):
       
   113         with codecs.open(filename, 'r', 'utf-8') as f:
       
   114             rst_data = f.read()
       
   115         f.close()
       
   116         content = publish_parts(rst_data, writer_name='html')['html_body']
       
   117     return render_template("/dates.html",
       
   118                            act="dates", content=content)
   108 
   119 
   109 
   120 
   110 @app.errorhandler(404)
   121 @app.errorhandler(404)
   111 def page_not_found(e):
   122 def page_not_found(e):
   112     msg = _(u"Url: %(url)s not found" , url=request.url)
   123     msg = _(u"Url: %(url)s not found" , url=request.url)
Impressum Datenschutzerklärung