pymove3d.py
changeset 162 90e47d2a2c40
parent 161 cb62df6e4e77
child 163 c87c8fe6c9bf
equal deleted inserted replaced
161:cb62df6e4e77 162:90e47d2a2c40
    23 
    23 
    24 app = Flask(__name__)
    24 app = Flask(__name__)
    25 babel = Babel(app)
    25 babel = Babel(app)
    26 
    26 
    27 app.config['BABEL_DEFAULT_LOCALE'] = 'de'
    27 app.config['BABEL_DEFAULT_LOCALE'] = 'de'
       
    28 
       
    29 def get_content(filename):
       
    30     content = u""
       
    31     if os.path.isfile(filename):
       
    32         with codecs.open(filename, 'r', 'utf-8') as f:
       
    33             rst_data = f.read()
       
    34         f.close()
       
    35         content = publish_parts(rst_data, writer_name='html')['html_body']
       
    36     return content
    28 
    37 
    29 def get_topmenue():
    38 def get_topmenue():
    30     menue =  [('/competition', _(u'Competition')),
    39     menue =  [('/competition', _(u'Competition')),
    31               ('/task', _(u'Task')),
    40               ('/task', _(u'Task')),
    32               ('/submission', _(u'Submission')),
    41               ('/submission', _(u'Submission')),
    69                            saying = saying,
    78                            saying = saying,
    70                            author = author)
    79                            author = author)
    71 
    80 
    72 @app.route("/competition")
    81 @app.route("/competition")
    73 def competition():
    82 def competition():
    74     return render_template(get_locale() + "/competition.html", act="competition")
    83     filename = os.path.join("templates", get_locale(), "rst", "competition.rst")
       
    84     content = get_content(filename)
       
    85     return render_template("/competition.html", act="competition", content=content)
    75 
    86 
    76 @app.route("/task")
    87 @app.route("/task")
    77 def task():
    88 def task():
    78     return render_template(get_locale() + "/task.html", act="task")
    89     return render_template(get_locale() + "/task.html", act="task")
    79 
    90 
   103 def competition_2014():
   114 def competition_2014():
   104     print get_locale() + "/archive/competitions/2014/index.html"
   115     print get_locale() + "/archive/competitions/2014/index.html"
   105     return render_template(get_locale() + "/archive/competitions/2014/index.html", 
   116     return render_template(get_locale() + "/archive/competitions/2014/index.html", 
   106                            act="coursematerial")
   117                            act="coursematerial")
   107 
   118 
       
   119 
   108 @app.route("/dates")
   120 @app.route("/dates")
   109 def dates():
   121 def dates():
   110     content = u""
       
   111     filename = os.path.join("templates", get_locale(), "rst", "dates.rst")
   122     filename = os.path.join("templates", get_locale(), "rst", "dates.rst")
   112     if os.path.isfile(filename):
   123     content = get_content(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",
   124     return render_template("/dates.html",
   118                            act="dates", content=content)
   125                            act="dates", content=content)
   119 
   126 
   120 
   127 
   121 @app.errorhandler(404)
   128 @app.errorhandler(404)
Impressum Datenschutzerklärung