| rb@217 |      1 | # -*- coding: utf-8 -*-
 | 
| rb@846 |      2 | #!/usr/bin/env python
 | 
| rb@280 |      3 | import logging
 | 
| rb@217 |      4 | 
 | 
| rb@186 |      5 | import os
 | 
| rb@186 |      6 | import codecs
 | 
| rb@275 |      7 | import vobject
 | 
| rb@275 |      8 | import StringIO
 | 
| rb@275 |      9 | 
 | 
| rb@275 |     10 | import qrcode
 | 
| rb@186 |     11 | 
 | 
| rb@186 |     12 | from docutils.core import publish_parts
 | 
| rb@275 |     13 | from flask import Flask
 | 
| peter@1 |     14 | from flask import render_template
 | 
| peter@1 |     15 | from flask import request
 | 
| rb@848 |     16 | from flask_babel import gettext as _
 | 
| rb@848 |     17 | from flask_babel import Babel
 | 
| rb@95 |     18 | from config import LANGUAGES
 | 
| rb@161 |     19 | 
 | 
| rb@275 |     20 | import base64
 | 
| rb@275 |     21 | 
 | 
| rb@122 |     22 | LANGUAGE_SELECTED = "de"
 | 
| icg179@496 |     23 | # ToDo after engelish is implemented set LANGUAGE_SELECTED = None
 | 
| rb@95 |     24 | 
 | 
| rb@246 |     25 | # We need the path of this file to find templates to translate
 | 
| rb@246 |     26 | ESKP_PATH = os.path.dirname(os.path.abspath(__file__))
 | 
| icg179@496 |     27 | logging.basicConfig(filename=os.path.join(ESKP_PATH, 'eskp-app.log'), level=logging.DEBUG)
 | 
| Tim@498 |     28 | FILES= os.listdir(os.path.join(ESKP_PATH, 'static/images/uvmap'))
 | 
| rb@246 |     29 | 
 | 
| peter@1 |     30 | app = Flask(__name__)
 | 
| peter@1 |     31 | babel = Babel(app)
 | 
| peter@1 |     32 | 
 | 
| peter@145 |     33 | app.config['BABEL_DEFAULT_LOCALE'] = 'de'
 | 
| peter@145 |     34 | 
 | 
| rb@275 |     35 | 
 | 
| rb@275 |     36 | def get_vcard(filename):
 | 
| rb@281 |     37 |     filename = os.path.join(ESKP_PATH, filename)
 | 
| rb@275 |     38 |     with codecs.open(filename, 'r', 'utf-8') as f:
 | 
| icg179@496 |     39 |         vcard = f.read()
 | 
| rb@275 |     40 |     return vobject.readOne(vcard)
 | 
| rb@275 |     41 | 
 | 
| rb@275 |     42 | 
 | 
| rb@214 |     43 | def get_content(filename, overrides=None):
 | 
| rb@162 |     44 |     content = u""
 | 
| rb@246 |     45 |     filename = os.path.join(ESKP_PATH, filename)
 | 
| rb@162 |     46 |     if os.path.isfile(filename):
 | 
| rb@162 |     47 |         with codecs.open(filename, 'r', 'utf-8') as f:
 | 
| rb@162 |     48 |             rst_data = f.read()
 | 
| rb@214 |     49 |         content = publish_parts(rst_data, writer_name='html', settings_overrides=overrides)['html_body']
 | 
| rb@162 |     50 |     return content
 | 
| rb@162 |     51 | 
 | 
| icg179@496 |     52 | 
 | 
| icg179@496 |     53 | def get_newest_date():
 | 
| Tim@498 |     54 |     getdates = get_valid_dates(FILES)
 | 
| icg179@496 |     55 |     newest_date = getdates[-1]
 | 
| icg179@496 |     56 | 
 | 
| icg179@496 |     57 |     return newest_date
 | 
| icg179@496 |     58 | 
 | 
| icg179@496 |     59 | 
 | 
| peter@142 |     60 | def get_topmenue():
 | 
| icg179@496 |     61 |     newest_date = get_newest_date()
 | 
| rb@238 |     62 |     menue = [
 | 
| icg179@496 |     63 |         ('/ozoneloss', _(u'Ozoneloss'),
 | 
| icg179@496 |     64 |          (('/ozoneloss', _(u'overview')),
 | 
| j@989 |     65 |           ('/ozoneloss/clams/2020', _(u'calculations')),
 | 
| j@989 |     66 |           ('/ozoneloss/vpsc/2020', _(u'estimations')),
 | 
| icg179@496 |     67 |           ('/ozoneloss/uvi', _(u'uv increase')),
 | 
| icg179@496 |     68 |           ('/ozoneloss/uvmap/' + newest_date, _(u'uv index map')))),
 | 
| icg179@496 |     69 |         ('/eskp', _(u'ESKP'), (None, None)),
 | 
| icg179@496 |     70 |         ('/iek-7', _(u'IEK-7'), (None, None))
 | 
| icg179@496 |     71 |     ]
 | 
| peter@145 |     72 |     return menue
 | 
| peter@142 |     73 | 
 | 
| icg179@496 |     74 | 
 | 
| peter@142 |     75 | app.jinja_env.globals.update(get_topmenue=get_topmenue)
 | 
| peter@142 |     76 | 
 | 
| icg179@496 |     77 | 
 | 
| j@250 |     78 | def get_o3lossclams_dates():
 | 
| rb@302 |     79 |     menue = [
 | 
| j@989 |     80 |         ('/ozoneloss/clams/2020', _(u'2020')),
 | 
| j@851 |     81 |         ('/ozoneloss/clams/2019', _(u'2019')),
 | 
| j@733 |     82 |         ('/ozoneloss/clams/2018', _(u'2018')),
 | 
| j@584 |     83 |         ('/ozoneloss/clams/2017', _(u'2017')),
 | 
| j@441 |     84 |         ('/ozoneloss/clams/2016', _(u'2016')),
 | 
| j@380 |     85 |         ('/ozoneloss/clams/2015', _(u'2015')),
 | 
| j@380 |     86 |         ('/ozoneloss/clams/2012', _(u'2012')),
 | 
| j@380 |     87 |         ('/ozoneloss/clams/2011', _(u'2011')),
 | 
| j@380 |     88 |         ('/ozoneloss/clams/2010', _(u'2010')),
 | 
| icg179@496 |     89 |     ]
 | 
| j@249 |     90 |     return menue
 | 
| j@249 |     91 | 
 | 
| icg179@496 |     92 | 
 | 
| icg179@496 |     93 | def get_valid_dates(files):
 | 
| icg179@496 |     94 |     dates = []
 | 
| icg179@496 |     95 | 
 | 
| icg179@496 |     96 |     for file in files:
 | 
| icg179@496 |     97 |         if file.endswith('.png') and file.find('uvi') >= 0:
 | 
| icg179@496 |     98 |             date = file[-12:-6]
 | 
| icg179@496 |     99 |             dates.append(date)
 | 
| icg179@496 |    100 |     dates.sort()
 | 
| icg179@496 |    101 |     for date in dates:
 | 
| icg179@496 |    102 |         i = 0
 | 
| icg179@496 |    103 |         for param in ['uvi', 'o3col', 'do3col']:
 | 
| icg179@496 |    104 |             testfile = 'clams_' + param + '_' + date + '12.png'
 | 
| icg179@496 |    105 |             if files.count(testfile) > 0:
 | 
| icg179@496 |    106 |                 i = i + 1
 | 
| icg179@496 |    107 |         if i <> 3:
 | 
| icg179@496 |    108 |             dates.remove(date)
 | 
| icg179@496 |    109 |     return dates
 | 
| icg179@496 |    110 | 
 | 
| icg179@496 |    111 | 
 | 
| icg179@496 |    112 | def get_o3lossuvmap_dates(date_show):
 | 
| Tim@498 |    113 |     dates = get_valid_dates(FILES)
 | 
| icg179@496 |    114 |     ndates = len(dates)
 | 
| icg179@496 |    115 |     ind = dates.index(date_show)
 | 
| j@503 |    116 |     navitexts = []
 | 
| icg179@496 |    117 |     if ind ==0 :
 | 
| icg179@496 |    118 |         chosendates = [dates[ind+1]]
 | 
| j@503 |    119 |         navitexts.append('next ->')
 | 
| Tim@501 |    120 | 
 | 
| icg179@496 |    121 |     elif ind >= ndates - 1:
 | 
| icg179@496 |    122 |         chosendates= [dates[ind-1]]
 | 
| j@503 |    123 |         navitexts.append('<- prev')
 | 
| icg179@496 |    124 |     else:
 | 
| icg179@496 |    125 |         chosendates = [dates[ind-1], dates[ind+1]]
 | 
| j@503 |    126 |         navitexts.append('<- prev')
 | 
| j@503 |    127 |         navitexts.append('next ->')
 | 
| icg179@496 |    128 |     menue = []
 | 
| Tim@501 |    129 | 
 | 
| Tim@501 |    130 |     for i in range(len(chosendates)):
 | 
| Tim@501 |    131 |         date = chosendates[i]
 | 
| j@503 |    132 |         navitext = navitexts[i]
 | 
| j@503 |    133 |         menue.append(('/ozoneloss/uvmap/' + date, _(navitext)))
 | 
| icg179@496 |    134 |     return menue
 | 
| icg179@496 |    135 | 
 | 
| icg179@496 |    136 | 
 | 
| j@249 |    137 | def get_vpsc_dates():
 | 
| rb@302 |    138 |     menue = [
 | 
| j@989 |    139 |         ('/ozoneloss/vpsc/2020', _(u'2020')),
 | 
| j@851 |    140 |         ('/ozoneloss/vpsc/2019', _(u'2019')),
 | 
| j@733 |    141 |         ('/ozoneloss/vpsc/2018', _(u'2018')),
 | 
| j@584 |    142 |         ('/ozoneloss/vpsc/2017', _(u'2017')),
 | 
| j@441 |    143 |         ('/ozoneloss/vpsc/2016', _(u'2016')),
 | 
| j@380 |    144 |         ('/ozoneloss/vpsc/2015', _(u'2015')),
 | 
| j@380 |    145 |         ('/ozoneloss/vpsc/2014', _(u'2014')),
 | 
| j@380 |    146 |         ('/ozoneloss/vpsc/2013', _(u'2013')),
 | 
| j@380 |    147 |         ('/ozoneloss/vpsc/2012', _(u'2012')),
 | 
| j@380 |    148 |         ('/ozoneloss/vpsc/2011', _(u'2011')),
 | 
| j@380 |    149 |         ('/ozoneloss/vpsc/2010', _(u'2010')),
 | 
| icg179@496 |    150 |     ]
 | 
| rb@241 |    151 |     return menue
 | 
| rb@241 |    152 | 
 | 
| icg179@496 |    153 | 
 | 
| j@250 |    154 | app.jinja_env.globals.update(get_o3lossclams_dates=get_o3lossclams_dates)
 | 
| j@249 |    155 | app.jinja_env.globals.update(get_vpsc_dates=get_vpsc_dates)
 | 
| icg179@496 |    156 | app.jinja_env.globals.update(get_o3lossuvmap_dates=get_o3lossuvmap_dates)
 | 
| peter@142 |    157 | 
 | 
| rb@267 |    158 | 
 | 
| rb@267 |    159 | def modal_info(template, act, title, filename):
 | 
| rb@264 |    160 |     content = get_content(filename)
 | 
| rb@267 |    161 |     html = render_template(template, act=act, title=title, content=content, exit=_(u"Close"))
 | 
| rb@264 |    162 |     return html
 | 
| rb@264 |    163 | 
 | 
| rb@264 |    164 | 
 | 
| peter@1 |    165 | @babel.localeselector
 | 
| peter@1 |    166 | def get_locale():
 | 
| peter@109 |    167 |     """ToDo: if translation is completed, switch to en """
 | 
| rb@118 |    168 |     return LANGUAGE_SELECTED or request.accept_languages.best_match(LANGUAGES.keys()) or 'de'
 | 
| peter@1 |    169 | 
 | 
| rb@100 |    170 | 
 | 
| peter@1 |    171 | @app.route("/")
 | 
| rb@100 |    172 | @app.route("/index")
 | 
| peter@1 |    173 | def index():
 | 
| rb@213 |    174 |     return render_template("/index.html",
 | 
| rb@233 |    175 |                            eskp_info=_(u'About ESKP'),
 | 
| rb@233 |    176 |                            )
 | 
| peter@1 |    177 | 
 | 
| rb@241 |    178 | 
 | 
| rb@257 |    179 | @app.route('/ozoneloss/clams/<year>')
 | 
| rb@257 |    180 | def ozoneloss_clams_year(year):
 | 
| j@249 |    181 |     filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_clams.rst")
 | 
| rb@241 |    182 |     content = get_content(filename)
 | 
| rb@257 |    183 |     return render_template("/ozoneloss_clams.html", act="ozoneloss/clams/%s" % year, content=content, year=year)
 | 
| rb@241 |    184 | 
 | 
| rb@241 |    185 | 
 | 
| icg179@496 |    186 | @app.route('/ozoneloss/uvmap/<date>')
 | 
| icg179@496 |    187 | def ozoneloss_uvmap_date(date):
 | 
| icg179@496 |    188 |     filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvmap.rst")
 | 
| icg179@496 |    189 |     content = get_content(filename)
 | 
| icg179@496 |    190 |     return render_template("/ozoneloss_uvmap.html", act="ozoneloss/uvmap/%s" % date, content=content, date=date)
 | 
| icg179@496 |    191 | 
 | 
| icg179@496 |    192 | 
 | 
| rb@257 |    193 | @app.route('/ozoneloss/vpsc/<year>')
 | 
| rb@257 |    194 | def ozoneloss_vspc_year(year):
 | 
| j@249 |    195 |     filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_vpsc.rst")
 | 
| j@249 |    196 |     content = get_content(filename)
 | 
| j@250 |    197 |     filename = os.path.join("templates", get_locale(), "rst", "explanation_vpsc.rst")
 | 
| j@250 |    198 |     explanation = get_content(filename)
 | 
| j@250 |    199 | 
 | 
| rb@257 |    200 |     return render_template("/ozoneloss_vpsc.html", act="ozoneloss/vpsc/%s" % year, content=content,
 | 
| rb@257 |    201 |                            content_explanation=explanation, year=year)
 | 
| rb@241 |    202 | 
 | 
| j@317 |    203 | 
 | 
| rb@118 |    204 | @app.route('/de')
 | 
| rb@118 |    205 | def de():
 | 
| rb@118 |    206 |     global LANGUAGE_SELECTED
 | 
| rb@118 |    207 |     LANGUAGE_SELECTED = "de"
 | 
| peter@160 |    208 |     return render_template("/index.html",
 | 
| rb@233 |    209 |                            eskp_info=_(u'About ESKP'),
 | 
| rb@233 |    210 |                            )
 | 
| rb@118 |    211 | 
 | 
| icg179@496 |    212 | 
 | 
| rb@118 |    213 | @app.route('/en')
 | 
| rb@118 |    214 | def en():
 | 
| rb@118 |    215 |     global LANGUAGE_SELECTED
 | 
| rb@118 |    216 |     LANGUAGE_SELECTED = "en"
 | 
| peter@160 |    217 |     return render_template("/index.html",
 | 
| rb@233 |    218 |                            eskp_info=_(u'About ESKP'),
 | 
| rb@233 |    219 |                            )
 | 
| rb@118 |    220 | 
 | 
| icg179@496 |    221 | 
 | 
| rb@233 |    222 | @app.route("/eskp")
 | 
| rb@233 |    223 | def eskp():
 | 
| rb@233 |    224 |     filename = os.path.join("templates", get_locale(), "rst", "eskp.rst")
 | 
| rb@162 |    225 |     content = get_content(filename)
 | 
| j@272 |    226 |     filename = os.path.join("templates", get_locale(), "rst", "eskp_title.rst")
 | 
| j@272 |    227 |     headline = get_content(filename)
 | 
| j@272 |    228 |     return render_template("/eskp.html", act="eskp", content=content, headline=headline)
 | 
| j@252 |    229 | 
 | 
| peter@1 |    230 | 
 | 
| rb@275 |    231 | def qr_image_data(card):
 | 
| icg179@496 |    232 |     buf = StringIO.StringIO()
 | 
| rb@275 |    233 |     qr = qrcode.QRCode(
 | 
| rb@275 |    234 |         version=1,
 | 
| rb@275 |    235 |         error_correction=qrcode.constants.ERROR_CORRECT_L,
 | 
| rb@275 |    236 |         box_size=2,
 | 
| rb@275 |    237 |         border=2,
 | 
| icg179@496 |    238 |     )
 | 
| rb@275 |    239 |     qr.add_data(card.serialize())
 | 
| rb@275 |    240 |     qr.make(fit=True)
 | 
| rb@275 |    241 |     img = qr.make_image()
 | 
| rb@275 |    242 |     img.save(buf)
 | 
| rb@275 |    243 |     image = buf.getvalue()
 | 
| rb@275 |    244 |     return base64.b64encode(image)
 | 
| rb@275 |    245 | 
 | 
| rb@275 |    246 | 
 | 
| rb@233 |    247 | @app.route("/ozoneloss")
 | 
| rb@257 |    248 | def ozoneloss():
 | 
| rb@233 |    249 |     filename = os.path.join("templates", get_locale(), "rst", "ozoneloss.rst")
 | 
| rb@165 |    250 |     content = get_content(filename)
 | 
| rb@275 |    251 | 
 | 
| rb@275 |    252 |     vcard_file = os.path.join("vcards", "jug.vcf")
 | 
| rb@275 |    253 |     author = u""
 | 
| icg179@496 |    254 | 
 | 
| rb@275 |    255 |     try:
 | 
| rb@275 |    256 |         card = get_vcard(vcard_file)
 | 
| rb@275 |    257 |     except IOError:
 | 
| rb@275 |    258 |         card = None
 | 
| rb@275 |    259 |     if card is not None:
 | 
| rb@275 |    260 |         qr_image = qr_image_data(card)
 | 
| rb@275 |    261 |         author = render_template("/author_info.html", act="author", title=_(u"Ozoneloss"),
 | 
| icg179@496 |    262 |                                  card=card, image=qr_image, contact=_(u"Contact"), exit=_(u"Close"))
 | 
| rb@275 |    263 | 
 | 
| rb@267 |    264 |     filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_publications.rst")
 | 
| rb@267 |    265 |     publications = modal_info("/publications_info.html", "publications", _(u"Ozoneloss"), filename)
 | 
| rb@264 |    266 |     return render_template("/ozoneloss.html", act="ozoneloss", content=content,
 | 
| icg179@496 |    267 |                            author=author, card=card, publications=publications)
 | 
| icg179@496 |    268 | 
 | 
| j@247 |    269 | 
 | 
| j@249 |    270 | @app.route("/ozoneloss/clams")
 | 
| rb@257 |    271 | def ozoneloss_clams():
 | 
| j@249 |    272 |     filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_clams.rst")
 | 
| j@247 |    273 |     content = get_content(filename)
 | 
| j@249 |    274 |     return render_template("/ozoneloss_clams.html", act="ozoneloss/clams", content=content)
 | 
| j@249 |    275 | 
 | 
| icg179@496 |    276 | 
 | 
| icg179@496 |    277 | @app.route("/ozoneloss/uvmap")
 | 
| icg179@496 |    278 | def ozoneloss_uvmap():
 | 
| icg179@496 |    279 |     filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvmap.rst")
 | 
| icg179@496 |    280 |     content = get_content(filename)
 | 
| icg179@496 |    281 |     return render_template("/ozoneloss_uvmap.html", act="ozoneloss/uvmap", content=content)
 | 
| icg179@496 |    282 | 
 | 
| icg179@496 |    283 | 
 | 
| j@249 |    284 | @app.route("/ozoneloss/vpsc")
 | 
| rb@257 |    285 | def ozoneloss_vspc():
 | 
| j@249 |    286 |     filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_vpsc.rst")
 | 
| j@249 |    287 |     content = get_content(filename)
 | 
| j@249 |    288 |     return render_template("/ozoneloss_vpsc.html", act="ozoneloss/vpsc", content=content)
 | 
| peter@1 |    289 | 
 | 
| j@380 |    290 | 
 | 
| j@380 |    291 | @app.route("/ozoneloss/uvi", methods=['GET'])
 | 
| j@317 |    292 | def ozoneloss_uvi():
 | 
| j@380 |    293 |     # XXX check 'POST' does not work
 | 
| j@317 |    294 |     filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvi.rst")
 | 
| j@317 |    295 |     content = get_content(filename)
 | 
| j@380 |    296 | 
 | 
| j@380 |    297 |     lat = 50.
 | 
| j@380 |    298 |     o3offset = 50.
 | 
| j@380 |    299 |     figname = "uvincr_lat%0.3i_do3%0.3i.svg" % (lat, o3offset)
 | 
| j@380 |    300 | 
 | 
| j@380 |    301 |     return render_template('ozoneloss_uvi.html', act="ozoneloss/uvi", content=content, figname=figname,
 | 
| j@380 |    302 |                            alt=_(u"UV increase at {{lat}} degrees N for {{o3offset}} DU ozone depletion"))
 | 
| j@380 |    303 | 
 | 
| icg179@496 |    304 | 
 | 
| j@380 |    305 | @app.route("/ozoneloss/uvi_graph", methods=['POST'])
 | 
| j@380 |    306 | def ozoneloss_uvi_graph():
 | 
| j@380 |    307 |     filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_uvi.rst")
 | 
| j@380 |    308 |     content = get_content(filename)
 | 
| j@380 |    309 | 
 | 
| j@380 |    310 |     latstr = request.form['Gradzahl']
 | 
| j@380 |    311 |     o3offsetstr = request.form['Dobson-Unit']
 | 
| j@380 |    312 | 
 | 
| j@380 |    313 |     latstr2 = latstr.replace(u'\xb0', '')
 | 
| j@380 |    314 | 
 | 
| j@380 |    315 |     if latstr2.endswith(u'N'):
 | 
| j@380 |    316 |         latstr2 = latstr2.replace(u'N', '')
 | 
| j@380 |    317 |         lat = float(latstr2)
 | 
| j@380 |    318 |     if latstr2.endswith(u'S'):
 | 
| j@380 |    319 |         latstr2 = latstr2.replace(u'S', '')
 | 
| j@380 |    320 |         lat = -float(latstr2)
 | 
| j@380 |    321 | 
 | 
| j@380 |    322 |     figname = "uvincr_lat%0.3i_do3%0.3i.svg" % (lat, float(o3offsetstr))
 | 
| j@380 |    323 | 
 | 
| j@380 |    324 |     return render_template('graph.html', act="ozoneloss_uvi_graph", content=content, figname=figname,
 | 
| j@380 |    325 |                            o3offsetstr=o3offsetstr, latstr=latstr)
 | 
| j@380 |    326 | 
 | 
| j@380 |    327 | 
 | 
| rb@233 |    328 | @app.route("/iek-7")
 | 
| rb@257 |    329 | def institute():
 | 
| rb@233 |    330 |     filename = os.path.join("templates", get_locale(), "rst", "iek-7.rst")
 | 
| rb@167 |    331 |     content = get_content(filename)
 | 
| rb@277 |    332 |     vcard_file = os.path.join("vcards", "sas.vcf")
 | 
| rb@277 |    333 |     author = u""
 | 
| rb@277 |    334 |     try:
 | 
| rb@277 |    335 |         card = get_vcard(vcard_file)
 | 
| rb@277 |    336 |     except IOError:
 | 
| rb@277 |    337 |         card = None
 | 
| rb@277 |    338 |     if card is not None:
 | 
| rb@277 |    339 |         qr_image = qr_image_data(card)
 | 
| rb@277 |    340 |         author = render_template("/author_info.html", act="author", title=_(u"IEK-7"),
 | 
| icg179@496 |    341 |                                  card=card, image=qr_image, contact=_(u"Contact"), exit=_(u"Close"))
 | 
| rb@277 |    342 | 
 | 
| rb@264 |    343 |     return render_template("/iek-7.html", act="iek-7", content=content,
 | 
| j@380 |    344 |                            author=author, card=card, contact=u"IEK-7")
 | 
| peter@1 |    345 | 
 | 
| peter@1 |    346 | 
 | 
| rb@100 |    347 | @app.route("/imprint")
 | 
| peter@88 |    348 | def imprint():
 | 
| rb@163 |    349 |     filename = os.path.join("templates", get_locale(), "rst", "imprint.rst")
 | 
| rb@163 |    350 |     content = get_content(filename)
 | 
| rb@170 |    351 |     return render_template("/content.html", act="imprint", content=content)
 | 
| peter@88 |    352 | 
 | 
| peter@109 |    353 | 
 | 
| rb@846 |    354 | @app.route("/dataprotection")
 | 
| rb@846 |    355 | def dataprotection():
 | 
| rb@846 |    356 |     filename = os.path.join("templates", get_locale(), "rst", "datenschutz.rst")
 | 
| rb@846 |    357 |     content = get_content(filename)
 | 
| rb@846 |    358 |     return render_template("/content.html", act="datenschutz", content=content)
 | 
| rb@845 |    359 | 
 | 
| rb@845 |    360 | 
 | 
| peter@1 |    361 | @app.errorhandler(404)
 | 
| peter@1 |    362 | def page_not_found(e):
 | 
| rb@213 |    363 |     msg = _(u"Url: %(url)s not found", url=request.url)
 | 
| rb@157 |    364 |     info = _(u"This information is not available!")
 | 
| rb@157 |    365 |     return render_template("404.html", msg=msg, info=info)
 | 
| peter@1 |    366 | 
 | 
| icg179@496 |    367 | 
 | 
| peter@1 |    368 | if __name__ == "__main__":
 | 
| j@503 |    369 |     app.run(host='localhost', port=5014)
 |