eskp: simplified API
authorReimar Bauer <rb.proj AT googlemail DOT com>
Mon, 12 May 2014 13:15:42 +0200
changeset 257e953d3dc48b7
parent 256 c9d4aa9ec58f
child 258 ec6fbfdc129c
eskp: simplified API
eskp.py
     1.1 --- a/eskp.py	Fri May 09 15:11:43 2014 +0200
     1.2 +++ b/eskp.py	Mon May 12 13:15:42 2014 +0200
     1.3 @@ -35,7 +35,6 @@
     1.4  
     1.5  def get_topmenue():
     1.6      menue = [
     1.7 -#            ('/', _(u'Startseite')),
     1.8               ('/ozoneloss', _(u'Ozoneloss')),
     1.9               ('/eskp', _(u'ESKP')),
    1.10               ('/iek-7', _(u'IEK-7')),
    1.11 @@ -77,80 +76,22 @@
    1.12                             )
    1.13  
    1.14  
    1.15 -@app.route('/ozoneloss/clams/2014')
    1.16 -def y2014():
    1.17 +@app.route('/ozoneloss/clams/<year>')
    1.18 +def ozoneloss_clams_year(year):
    1.19      filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_clams.rst")
    1.20      content = get_content(filename)
    1.21 -    return render_template("/ozoneloss_clams.html", act="ozoneloss/clams/2014", content=content, year=2014)
    1.22 +    return render_template("/ozoneloss_clams.html", act="ozoneloss/clams/%s" % year, content=content, year=year)
    1.23  
    1.24 -@app.route('/ozoneloss/clams/2013')
    1.25 -def y2013():
    1.26 -    filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_clams.rst")
    1.27 -    content = get_content(filename)
    1.28 -    return render_template("/ozoneloss_clams.html", act="ozoneloss/clams/2013", content=content, year=2013)
    1.29  
    1.30 -@app.route('/ozoneloss/clams/2012')
    1.31 -def y2012():
    1.32 -    filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_clams.rst")
    1.33 -    content = get_content(filename)
    1.34 -    return render_template("/ozoneloss_clams.html", act="ozoneloss/clams/2012", content=content, year=2012)
    1.35 -
    1.36 -@app.route('/ozoneloss/clams/2011')
    1.37 -def y2011():
    1.38 -    filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_clams.rst")
    1.39 -    content = get_content(filename)
    1.40 -    return render_template("/ozoneloss_clams.html", act="ozoneloss/clams/2011", content=content, year=2011)
    1.41 -
    1.42 -@app.route('/ozoneloss/clams/2010')
    1.43 -def y2010():
    1.44 -    filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_clams.rst")
    1.45 -    content = get_content(filename)
    1.46 -    return render_template("/ozoneloss_clams.html", act="ozoneloss/clams/2010", content=content, year=2010)
    1.47 -
    1.48 -@app.route('/ozoneloss/vpsc/2014')
    1.49 -def y2014a():
    1.50 +@app.route('/ozoneloss/vpsc/<year>')
    1.51 +def ozoneloss_vspc_year(year):
    1.52      filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_vpsc.rst")
    1.53      content = get_content(filename)
    1.54      filename = os.path.join("templates", get_locale(), "rst", "explanation_vpsc.rst")
    1.55      explanation = get_content(filename)
    1.56  
    1.57 -    return render_template("/ozoneloss_vpsc.html", act="ozoneloss/vpsc/2014", content=content, content_explanation=explanation, year=2014)
    1.58 -
    1.59 -@app.route('/ozoneloss/vpsc/2013')
    1.60 -def y2013a():
    1.61 -    filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_vpsc.rst")
    1.62 -    content = get_content(filename)
    1.63 -    filename = os.path.join("templates", get_locale(), "rst", "explanation_vpsc.rst")
    1.64 -    explanation = get_content(filename)
    1.65 -
    1.66 -    return render_template("/ozoneloss_vpsc.html", act="ozoneloss/vpsc/2014", content=content, content_explanation=explanation, year=2013)
    1.67 -
    1.68 -@app.route('/ozoneloss/vpsc/2012')
    1.69 -def y2012a():
    1.70 -    filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_vpsc.rst")
    1.71 -    content = get_content(filename)
    1.72 -    filename = os.path.join("templates", get_locale(), "rst", "explanation_vpsc.rst")
    1.73 -    explanation = get_content(filename)
    1.74 -
    1.75 -    return render_template("/ozoneloss_vpsc.html", act="ozoneloss/vpsc/2014", content=content, content_explanation=explanation, year=2012)
    1.76 -
    1.77 -@app.route('/ozoneloss/vpsc/2011')
    1.78 -def y2011a():
    1.79 -    filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_vpsc.rst")
    1.80 -    content = get_content(filename)
    1.81 -    filename = os.path.join("templates", get_locale(), "rst", "explanation_vpsc.rst")
    1.82 -    explanation = get_content(filename)
    1.83 -
    1.84 -    return render_template("/ozoneloss_vpsc.html", act="ozoneloss/vpsc/2014", content=content, content_explanation=explanation, year=2011)
    1.85 -
    1.86 -@app.route('/ozoneloss/vpsc/2010')
    1.87 -def y2010a():
    1.88 -    filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_vpsc.rst")
    1.89 -    content = get_content(filename)
    1.90 -    filename = os.path.join("templates", get_locale(), "rst", "explanation_vpsc.rst")
    1.91 -    explanation = get_content(filename)
    1.92 -
    1.93 -    return render_template("/ozoneloss_vpsc.html", act="ozoneloss/vpsc/2014", content=content, content_explanation=explanation, year=2010)
    1.94 +    return render_template("/ozoneloss_vpsc.html", act="ozoneloss/vpsc/%s" % year, content=content,
    1.95 +                           content_explanation=explanation, year=year)
    1.96  
    1.97  @app.route('/de')
    1.98  def de():
    1.99 @@ -182,28 +123,28 @@
   1.100  
   1.101  
   1.102  @app.route("/ozoneloss")
   1.103 -def task():
   1.104 +def ozoneloss():
   1.105      filename = os.path.join("templates", get_locale(), "rst", "ozoneloss.rst")
   1.106      content = get_content(filename)
   1.107      return render_template("/ozoneloss.html", act="ozoneloss", content=content)
   1.108  
   1.109  @app.route("/ozoneloss/clams")
   1.110 -def task1():
   1.111 +def ozoneloss_clams():
   1.112      filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_clams.rst")
   1.113      content = get_content(filename)
   1.114      return render_template("/ozoneloss_clams.html", act="ozoneloss/clams", content=content)
   1.115  
   1.116  @app.route("/ozoneloss/vpsc")
   1.117 -def task2():
   1.118 +def ozoneloss_vspc():
   1.119      filename = os.path.join("templates", get_locale(), "rst", "ozoneloss_vpsc.rst")
   1.120      content = get_content(filename)
   1.121      return render_template("/ozoneloss_vpsc.html", act="ozoneloss/vpsc", content=content)
   1.122  
   1.123  @app.route("/iek-7")
   1.124 -def submission():
   1.125 +def institute():
   1.126      filename = os.path.join("templates", get_locale(), "rst", "iek-7.rst")
   1.127      content = get_content(filename)
   1.128 -    return render_template("/iek-7.html", act="submission", content=content)
   1.129 +    return render_template("/iek-7.html", act="iek-7", content=content)
   1.130  
   1.131  
   1.132  @app.route("/imprint")
Impressum Datenschutzerklärung