annotate browser_side/tools.py @ 52:4419ef07bb2b

browser side: adding contact, first draft
author Goffi <goffi@goffi.org>
date Fri, 27 May 2011 01:52:29 +0200
parents cb07078f8d6f
children 9d8e79ac4c9c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/python
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
3
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
4 """
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
5 Libervia: a Salut à Toi frontend
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
6 Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org)
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
7
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
8 This program is free software: you can redistribute it and/or modify
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
9 it under the terms of the GNU Affero General Public License as published by
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
11 (at your option) any later version.
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
12
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
13 This program is distributed in the hope that it will be useful,
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
16 GNU Affero General Public License for more details.
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
17
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
18 You should have received a copy of the GNU Affero General Public License
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
20 """
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
21
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
22 def html_sanitize(html):
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
23 """Naive sanitization of HTML"""
cb07078f8d6f browser_side: added naive html sanitize method
Goffi <goffi@goffi.org>
parents:
diff changeset
24 return html.replace('<','&lt;').replace('>','&gt;')