equal
deleted
inserted
replaced
18 babel = Babel(app) |
18 babel = Babel(app) |
19 |
19 |
20 app.config['BABEL_DEFAULT_LOCALE'] = 'de' |
20 app.config['BABEL_DEFAULT_LOCALE'] = 'de' |
21 |
21 |
22 |
22 |
23 def get_content(filename): |
23 def get_content(filename, settings=None): |
24 content = u"" |
24 content = u"" |
25 if os.path.isfile(filename): |
25 if os.path.isfile(filename): |
26 with codecs.open(filename, 'r', 'utf-8') as f: |
26 with codecs.open(filename, 'r', 'utf-8') as f: |
27 rst_data = f.read() |
27 rst_data = f.read() |
28 f.close() |
28 f.close() |
29 content = publish_parts(rst_data, writer_name='html')['html_body'] |
29 content = publish_parts(rst_data, writer_name='html', settings_overwrite=settings)['html_body'] |
30 return content |
30 return content |
31 |
31 |
32 def get_topmenue(): |
32 def get_topmenue(): |
33 menue = [('/competition', _(u'Competition')), |
33 menue = [('/competition', _(u'Competition')), |
34 ('/task', _(u'Task')), |
34 ('/task', _(u'Task')), |
48 |
48 |
49 @app.route("/") |
49 @app.route("/") |
50 @app.route("/index") |
50 @app.route("/index") |
51 def index(): |
51 def index(): |
52 saying, author = get_saying() |
52 saying, author = get_saying() |
53 return render_template("/index.html", |
53 return render_template("/index.html", |
54 saying=saying, |
54 saying=saying, |
55 author=author, |
55 author=author, |
56 competition_info=_(u'About Competition'), |
56 competition_info=_(u'About Competition'), |
57 dates=_(u'Dates'), |
57 dates=_(u'Dates'), |
58 impressions=_(u'Impressions')) |
58 impressions=_(u'Impressions')) |
112 return render_template("/content.html", act="imprint", content=content) |
112 return render_template("/content.html", act="imprint", content=content) |
113 |
113 |
114 @app.route("/privacy") |
114 @app.route("/privacy") |
115 def privacy(): |
115 def privacy(): |
116 filename = os.path.join("templates", get_locale(), "rst", "privacy.rst") |
116 filename = os.path.join("templates", get_locale(), "rst", "privacy.rst") |
117 content = get_content(filename) |
117 settings_overrides = { |
|
118 'initial_header_level': 2, |
|
119 } |
|
120 content = get_content(filename, settings=settings_overrides) |
118 return render_template("/content.html", act="privacy", content=content) |
121 return render_template("/content.html", act="privacy", content=content) |
119 |
122 |
120 @app.route("/dates") |
123 @app.route("/dates") |
121 def dates(): |
124 def dates(): |
122 filename = os.path.join("templates", get_locale(), "rst", "dates.rst") |
125 filename = os.path.join("templates", get_locale(), "rst", "dates.rst") |
130 act="competition_2013") |
133 act="competition_2013") |
131 |
134 |
132 |
135 |
133 @app.errorhandler(404) |
136 @app.errorhandler(404) |
134 def page_not_found(e): |
137 def page_not_found(e): |
135 msg = _(u"Url: %(url)s not found" , url=request.url) |
138 msg = _(u"Url: %(url)s not found", url=request.url) |
136 info = _(u"This information is not available!") |
139 info = _(u"This information is not available!") |
137 return render_template("404.html", msg=msg, info=info) |
140 return render_template("404.html", msg=msg, info=info) |
138 |
141 |
139 if __name__ == "__main__": |
142 if __name__ == "__main__": |
140 app.run(host='localhost', port=5014, debug=True) |
143 app.run(host='localhost', port=5014, debug=True) |