root/Cheetah/Utils/htmlDecode.py

Revision f17b49bd2a9cb5c693518283252cdbca4d04136b, 437 bytes (checked in by Jason Michalski <armooo@armooo.net>, 2 years ago)

Lets try the import again

  • Property mode set to 100644
Line 
1 """This is a copy of the htmlDecode function in Webware.
2
3 @@TR: It implemented more efficiently.
4
5 """
6
7 from Cheetah.Utils.htmlEncode import htmlCodesReversed
8
9 def htmlDecode(s, codes=htmlCodesReversed):
10     """ Returns the ASCII decoded version of the given HTML string. This does
11     NOT remove normal HTML tags like <p>. It is the inverse of htmlEncode()."""
12     for code in codes:
13         s = s.replace(code[1], code[0])
14     return s
Note: See TracBrowser for help on using the browser.