%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/paste/debug/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/paste/debug/wdg_validate.pyc

�
|��Wc@sydZddlmZddlZddlmZddlZddlZdgZde	fd��YZ
dd�ZdS(	s�
Middleware that tests the validity of all generated HTML using the
`WDG HTML Validator <http://www.htmlhelp.com/tools/validator/>`_
i����(tStringION(theader_valuetWDGValidateMiddlewarecBsMeZdZejdej�Zddd�Zd�Z	d�Z
d�ZRS(sb
    Middleware that checks HTML and appends messages about the validity of
    the HTML.  Uses: http://www.htmlhelp.com/tools/validator/ -- interacts
    with the command line client.  Use the configuration ``wdg_path`` to
    override the path (default: looks for ``validate`` in $PATH).

    To install, in your web context's __init__.py::

        def urlparser_wrap(environ, start_response, app):
            return wdg_validate.WDGValidateMiddleware(app)(
                environ, start_response)

    Or in your configuration::

        middleware.append('paste.wdg_validate.WDGValidateMiddleware')
    s</body>tvalidatecCs||_||_dS(N(tapptwdg_path(tselfRtglobal_confR((sI/opt/alt/python27/lib/python2.7/site-packages/paste/debug/wdg_validate.pyt__init__%s	c	s�t��g�d���fd�}|j||�}z"x|D]}�j|�qCWWdt|d�rz|j�nX�j�}�\}}t|d�p�d}	|	jd�r�|	jd�r�|	jd�r�|gSg}
|	jd�r|
j	d	�n|j
|j|
|�}|r||j||�d
}|j
dtt|d��f�|j	dtt|��f�n|gS(
Ncs*�j||f��|||��jS(N(textendtwrite(tstatustheaderstexc_info(toutputtresponsetstart_response(sI/opt/alt/python27/lib/python2.7/site-packages/paste/debug/wdg_validate.pytwriter_start_response-stclosescontent-typets	text/htmls
text/xhtmlsapplication/xhtmlstext/xhtml+xmls--xmlisContent-Lengthscontent-length(RtNoneRR
thasattrRtgetvalueRt
startswithtappendtcall_wdg_validateRt	add_errortremovetstrtlen(RtenvironRRtapp_itertstpageRRtvtopsthtml_errors((RRRsI/opt/alt/python27/lib/python2.7/site-packages/paste/debug/wdg_validate.pyt__call__)s8	
"cCsytdkrtd��ntj|g|dtdtdtjdtjdtj�}|j|�d}|j	�|S(Ns>This middleware requires the subprocess module from Python 2.4tshellt	close_fdststdouttstdintstderri(
t
subprocessRt
ValueErrortPopentFalsetTruetPIPEtSTDOUTtcommunicatetwait(RRR#R!tprocR(((sI/opt/alt/python27/lib/python2.7/site-packages/paste/debug/wdg_validate.pyRPs		
cCs]dtj|�}|jj|�}|rN||j� |||j�gS||gSdS(NsR<pre style="background-color: #ffd; color: #600; border: 1px solid #000;">%s</pre>(tcgitescapet_end_body_regextsearchtstart(Rt	html_pageR$tadd_texttmatch((sI/opt/alt/python27/lib/python2.7/site-packages/paste/debug/wdg_validate.pyR_s#N(t__name__t
__module__t__doc__tretcompiletIR7RRR%RR(((sI/opt/alt/python27/lib/python2.7/site-packages/paste/debug/wdg_validate.pyRs	'	RcCst||d|�S(s
    Wraps the application in the WDG validator from
    http://www.htmlhelp.com/tools/validator/

    Validation errors are appended to the text of each page.
    You can configure this by giving the path to the validate
    executable (by default picked up from $PATH)
    R(R(RRR((sI/opt/alt/python27/lib/python2.7/site-packages/paste/debug/wdg_validate.pytmake_wdg_validate_middlewareks
(R?t	cStringIORR+tpaste.responseRR@R5t__all__tobjectRRC(((sI/opt/alt/python27/lib/python2.7/site-packages/paste/debug/wdg_validate.pyt<module>s	\

Zerion Mini Shell 1.0