Mercurial > sat_legacy_website
annotate sat_website/social_contract.py @ 69:b39b48519820
add details in adhesion.html
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 27 May 2015 14:42:41 +0200 |
parents | bdd6ccffe149 |
children |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 """ | |
4 SàT website: Salut à Toi's presentation website | |
5 Copyright (C) 2012 Jérôme Poisson (goffi@goffi.org) | |
6 | |
7 This file is part of SàT website. | |
8 | |
9 SàT website is free software: you can redistribute it and/or modify | |
10 it under the terms of the GNU Affero General Public License as published by | |
11 the Free Software Foundation, either version 3 of the License, or | |
12 (at your option) any later version. | |
13 | |
14 Foobar is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU Affero General Public License for more details. | |
18 | |
19 You should have received a copy of the GNU Affero General Public License | |
20 along with Foobar. If not, see <http://www.gnu.org/licenses/>. | |
21 """ | |
22 | |
8
c70038fb98dc
Social Contract (Contrat Social) localisation
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
23 from os.path import join, dirname, exists |
c70038fb98dc
Social Contract (Contrat Social) localisation
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
24 from django.utils.translation import get_language |
c70038fb98dc
Social Contract (Contrat Social) localisation
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
25 CONTRAT_SOCIAL = "CONTRAT_SOCIAL" |
0 | 26 |
8
c70038fb98dc
Social Contract (Contrat Social) localisation
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
27 def get_social_contract(): |
0 | 28 """Return the localised social contract version""" |
9 | 29 language_code = get_language().split("-")[0] |
8
c70038fb98dc
Social Contract (Contrat Social) localisation
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
30 filename = CONTRAT_SOCIAL if language_code == "fr" else "CONTRAT_SOCIAL_%s" % (language_code,) |
c70038fb98dc
Social Contract (Contrat Social) localisation
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
31 path = join(dirname(__file__), filename) |
c70038fb98dc
Social Contract (Contrat Social) localisation
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
32 if not exists(path): |
c70038fb98dc
Social Contract (Contrat Social) localisation
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
33 path = join(dirname(__file__), CONTRAT_SOCIAL) #we default to original version |
c70038fb98dc
Social Contract (Contrat Social) localisation
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
34 |
0 | 35 with open(path) as f: |
36 text = f.read() | |
37 return text | |
38 |