Ñò -¥;Hc @sddkZddkZddkZddkZddkZddklZhdd6dd6dd6d d 6d d 6Zd „Zd„Zd„Z d„Z d„Z de fd„ƒYZ e ƒZeidƒZd„Zde fd„ƒYZeeieiƒZeiZeiZd„Zeideƒh dd6dd6dd6d d!6d"d#6d$d$6d%d%6d&d&6d'd'6Zd(Zd)Zeid*eefƒZeid+ƒZ hdd6dd6d,d-6Z!eid.ƒZ"hdd6dd6dd6d/d 6d0d 6d,d-6Z#d1„Z$dd2„Z&dS(3iÿÿÿÿN(tStringIOs&t&s>t>s<t])cSst|iƒS((t xml_escapestgroup(tm((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyts(tretsub(R ((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyt xml_escapescCs|idƒ}ti|ƒS(Ntutf8(tencodeturllibt quote_plus(R ((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyt url_escapescCs3ti|ƒ}t|ƒp|idƒ}n|S(NR(Rt unquote_plust is_ascii_strtdecode(R ttext((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyt url_unescape!s cCs |iƒS(N(tstrip(R ((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyttrim'stDecodecBseZd„ZRS(cs‡fd†}|S(NcsPt|tƒo|St|tƒptt|ƒdˆƒSt|dˆƒSdS(Ntencoding(t isinstancetunicodetstr(tx(tkey(s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyR-s ((tselfR$R((R$s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyt __getattr__,s(t__name__t __module__R&(((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyR+ss\A[\x00-\x7f]*\ZcCst|tƒo ti|ƒS(N(R R"t _ASCII_retmatch(R((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyR:stXMLEntityEscapercBsieZd„Zd„Zd„ZeidƒZd„Zeidei ei BƒZ d„Z d„Z RS(cCsMtg}|iƒD]\}}||d|fq~ƒ|_||_dS(Nu&%s;(tdictt iteritemstcodepoint2entitytname2codepoint(R%tcodepoint2nameR/t_[1]tctn((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyt__init__@s 6cCst|ƒi|iƒS(sŠReplace characters with their character entity references. Only characters corresponding to a named entity are replaced. (R!t translateR.(R%R((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pytescape_entitiesEscCsFt|iƒƒ}y|i|SWnttfj o d|SXdS(Ns&#x%X;(tordR R.tKeyErrort IndexError(R%R t codepoint((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyt__escapeLs s["&<>]|[^\x00-\x7f]cCs%|ii|it|ƒƒidƒS(s3Replace characters with their character references. Replace characters by their named entity references. Non-ASCII characters, if they do not have a named entity reference, are replaced by numerical character references. The return value is guaranteed to be ASCII. tascii(t_XMLEntityEscaper__escapableRt_XMLEntityEscaper__escapeR!R(R%R((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyRVs så& (?: \#(\d+) | \#x([\da-f]+) | ( (?!\d) [:\w] [-.:\w]+ ) ) ;cCs}|iƒ\}}}|ot|ƒ}n0|ot|dƒ}n|ii|dƒ}|djo t|ƒSt|ƒS(Niiýÿi€(tgroupstintR/tgettchrtunichr(R%R tdvalthvaltnameR:((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyt __unescapems  cCs|ii|i|ƒS(sœUnescape character references. All character references (both entity references and numerical character references) are unescaped. (t _XMLEntityEscaper__characterrefsRt_XMLEntityEscaper__unescape(R%R((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pytunescapezs(R'R(R4R6R>RtcompileR=RtXtUNICODERHRIRJ(((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyR+?s     cCsSt|tƒo9|i|i|i!}ti|ƒ}t|ƒ|ifS|‚dS(s4An encoding error handler. This python `codecs`_ error handler replaces unencodable characters with HTML entities, or, if no HTML entity exists for the character, XML character references. >>> u'The cost was \u20ac12.'.encode('latin1', 'htmlentityreplace') 'The cost was €12.' N(R tUnicodeEncodeErrortobjecttstarttendt_html_entities_escaperRR!(textbad_textR((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pythtmlentityreplace_errorsŠs thtmlentityreplacesfilters.xml_escapeR#sfilters.html_escapethsfilters.url_escapetus filters.trimRsfilters.html_entities_escapetentityR!RR"R3s [- - -]sï¿[¾¿]s%s|%ss[&<]|]]>s]]>s]]>s [&<>"']|]]>s"s'cCs1ti|ƒotid„|ƒd}n|S(NcSsdt|iƒƒS(s&#%i;(R7R (R ((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyRÎsi(tXML_ILLEGAL_CHAR_PATTERNtsearchtsubn(t characters((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pytremoveIllegalCharsËs cCs´|pdS|o:ti|ƒo titd„|ƒd}qƒ|}n7ti|ƒo titd„|ƒd}n|}ti|ƒotid„|ƒd}n|S(s)Translate characters into a legal format.tcSs||iƒS((R (R td((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyRÙsicSs||iƒS((R (R R`((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyRàscSsdt|iƒƒS(s&#%i;(R7R (R ((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyRæs(tg_cdataCharPatternR[R\tg_charToEntitytg_cdataCharPatternReqtg_charToEntityReqRZ(R]t allEntRefst new_string((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyttranslateCdataÒs$   ('RRRthtmlentitydefstcodecsRR R RRRRRORRRKR)RR+R0R/RRR6thtml_entities_escapeRJthtml_entities_unescapeRUtregister_errortDEFAULT_ESCAPEStILLEGAL_LOW_CHARStILLEGAL_HIGH_CHARSRZRcRdRaRbR^tNoneRg(((s:/usr/lib/python2.6/site-packages/weberror/util/escaping.pyt sh<        D