Ñò
Û·Lc @ sè d d k Z d d k Z d d k Z d d k Z d d d d d g Z d Z d d „ Z e i d ƒ Z e i
d
„ Z d d „ Z d „ Z
d
„ Z e i d ƒ Z d „ Z e i Z e i Z e d j o d d k Z e i ƒ n d S( iÿÿÿÿNt
html_quotet html_unquotet url_quotet url_unquotet
strip_htmls UTF-8c C s | p t } | d j o d St | t ƒ o t i | d ƒ St | t ƒ o t i | i | ƒ d ƒ St i t | ƒ i | ƒ d ƒ Sd S( sú
Quote the value (turned to a string) as HTML. This quotes <, >,
and quotes:
>>> html_quote(1)
'1'
>>> html_quote(None)
''
>>> html_quote('')
'<hey!>'
>>> html_quote(u'\u1029')
'\xe1\x80\xa9'
t i N( t default_encodingt Nonet
isinstancet strt cgit escapet unicodet encode( t vt encoding( ( s6 /usr/lib/python2.6/site-packages/paste/util/quoting.pyR s
s
&([a-zA-Z]+);c C s; | i | i d ƒ ƒ } | o t | ƒ S| i d ƒ Sd S( Ni i ( t gett groupt unichr( t matcht name2ct code( ( s6 /usr/lib/python2.6/site-packages/paste/util/quoting.pyt _entity_subber' s c C sL t | t ƒ o, | d j o d S| i | p t ƒ } n t i t | ƒ S( sæ
Decode the value.
>>> html_unquote('<hey you>')
u''
>>> html_unquote('')
u''
>>> html_unquote('&blahblah;')
u'&blahblah;'
>>> html_unquote('\xe1\x80\xa9')
u'\u1029'
R u ( R R t decodeR t _unquote_ret subR ( t sR ( ( s6 /usr/lib/python2.6/site-packages/paste/util/quoting.pyR . s
c C s% t i d d | ƒ } t | ƒ } | S( Ns <.*?>R ( t reR R ( R ( ( s6 /usr/lib/python2.6/site-packages/paste/util/quoting.pyR C s c C s | S( s*
Quoting that doesn't do anything
( ( R ( ( s6 /usr/lib/python2.6/site-packages/paste/util/quoting.pyt no_quoteI s s \-\s*\>c C s t i d t | ƒ ƒ S( s;
Quote that makes sure text can't escape a comment
s ->( t _comment_quote_reR R ( R ( ( s6 /usr/lib/python2.6/site-packages/paste/util/quoting.pyt
comment_quoteP s t __main__( R
t htmlentitydefst urllibR t __all__R R R t compileR t name2codepointR R R R R R t quoteR t unquoteR t __name__t doctestt testmod( ( ( s6 /usr/lib/python2.6/site-packages/paste/util/quoting.pyt s&