Mercurial > libervia-web
comparison src/server/html_tools.py @ 451:1a0cec9b0f1e
better PEP-8 compliance
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 20 May 2014 10:54:03 +0200 |
parents | 981ed669d3b3 |
children | c8cca1a373dd |
comparison
equal
deleted
inserted
replaced
450:41aae13cab2b | 451:1a0cec9b0f1e |
---|---|
15 # GNU Affero General Public License for more details. | 15 # GNU Affero General Public License for more details. |
16 | 16 |
17 # You should have received a copy of the GNU Affero General Public License | 17 # You should have received a copy of the GNU Affero General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 | |
20 def sanitizeHtml(text): | 21 def sanitizeHtml(text): |
21 """Sanitize HTML by escaping everything""" | 22 """Sanitize HTML by escaping everything""" |
22 #this code comes from official python wiki: http://wiki.python.org/moin/EscapingHtml | 23 #this code comes from official python wiki: http://wiki.python.org/moin/EscapingHtml |
23 html_escape_table = { | 24 html_escape_table = { |
24 "&": "&", | 25 "&": "&", |
26 "'": "'", | 27 "'": "'", |
27 ">": ">", | 28 ">": ">", |
28 "<": "<", | 29 "<": "<", |
29 } | 30 } |
30 | 31 |
31 return "".join(html_escape_table.get(c,c) for c in text) | 32 return "".join(html_escape_table.get(c, c) for c in text) |
32 |