forked from guypeer8/Mu-Law
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
68 lines (48 loc) · 1.92 KB
/
index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from flask import Flask, redirect, url_for
from app import *
from app.config import SECRET
from app.renderers import render_thankyou, render_page
app = Flask(__name__)
app.config['SECRET_KEY'] = SECRET
@app.route('/')
def index():
return redirect(url_for('switch_lang', language='en'))
@app.route('/<language>')
def switch_lang(language):
return render_page('index.html', language=language, description=description)
@app.route('/<language>/expertise')
def expertise(language):
return render_page('expertise.html', data=legal_expertise, on_expertise=True, language=language)
@app.route('/<language>/lawyers')
def lawyers(language):
return render_page('lawyers.html', data=lawyers_list, language=language)
# @app.route('/<language>/contact', methods=['GET', 'POST'])
# def contact(language):
# labels = contact_form[language]
# title = labels['title']
# name = labels['name']
# email = labels['email']
# text = labels['text']
# submit = labels['submit']
# form = VisitorForm()
# if form.validate_on_submit():
# subject = 'mu-law.com'
# body = 'Message:\n' + form.text.data
# body += '\n\nname: ' + form.name.data
# from_email = form.email.data
# send_email(subject, body, from_email)
# return redirect(url_for('thank_you', language=language))
# return render_contact(form, title, name, email, text, submit, language)
@app.route('/<language>/thank-you')
def thank_you(language):
return render_thankyou(thanks[language], language=language)
@app.errorhandler(404)
def page_not_found(e):
message = 'Sorry, but the page you requested was not found.'
return render_thankyou(message, 404)
@app.errorhandler(500)
def internal_server_error(e):
message = '<p>Sorry, the server is unable to handle your request.</p><p>Please try again in a few minutes.</p>'
return render_thankyou(message, 500)
if __name__ == '__main__':
app.run()