ģō
;
Dc           @   si   d  Z  d d k l Z l Z d d k Z d d k Z d e f d     YZ d   Z d   Z	 d   Z
 d S(	   sS   

This module is a mod_python handler that can be used to test the configuration.

iĸĸĸĸ(   t   apachet   utilNt   bounded_bufferc           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s   
        This class implements a bounded buffer, i.e. a list that keeps the last
        n lines. It doesn't use pop(0), which is costly.
    
    c         C   s   | |  _  g  |  _ d |  _ d  S(   Ni    (   t   max_sizet   listt   pos(   t   selft   size(    (    s:   /usr/lib/python2.5/site-packages/mod_python/testhandler.pyt   __init__#   s    		c         C   sX   t  |  i  |  i j  o |  i i |  n | |  i |  i <|  i d |  i |  _ d  S(   Ni   (   t   lenR   R   t   appendR   (   R   t   value(    (    s:   /usr/lib/python2.5/site-packages/mod_python/testhandler.pyR
   (   s    c         C   s   |  i  |  i |  i  |  i  S(   N(   R   R   (   R   (    (    s:   /usr/lib/python2.5/site-packages/mod_python/testhandler.pyt   items/   s    c         C   s   t  |  i    S(   N(   t   iterR   (   R   (    (    s:   /usr/lib/python2.5/site-packages/mod_python/testhandler.pyt   __iter__2   s    (   t   __name__t
   __module__t   __doc__R   R
   R   R   (    (    (    s:   /usr/lib/python2.5/site-packages/mod_python/testhandler.pyR      s
   			c         C   sW   |  i  d  |  i  d  x) | D]! } |  i  d | | | f  q! W|  i  d  d  S(   Ns   <table border="1">s$   <tr><th>Key</th><th>Value</th></tr>
s:   <tr><td><code>%s</code></td><td><code>%s</code></td></tr>
s   </table>(   t   write(   t   reqt   tablet   key(    (    s:   /usr/lib/python2.5/site-packages/mod_python/testhandler.pyt   write_table5   s     	c         C   sq   xj | D]b } t  | t  o t |  | | d  q |  i d |  |  i d i |   |  i d  q Wd  S(   Ni   s       t    s   
(   t
   isinstanceR   t
   write_treeR   t   join(   R   t   treet   levelt   entry(    (    s:   /usr/lib/python2.5/site-packages/mod_python/testhandler.pyR   ?   s     c         C   sK  t  i |   |  _ |  i i d  o t t i i t i	   |  i
 i  d  } t d  } x | D] } | i |  qb W| i   d |  _ x | D] } |  i |  q Wt i Sn |  i   d |  _ |  i d  |  i d  |  i d  |  i d	 d
 |  i i d  f  |  i d	 d t i t i  o d t i t i  p d f  |  i d	 d t i t i  o d t i t i  p d f  |  i d	 d t i	   f  |  i d	 d |  i   f  |  i
 i o6 |  i d d t i i t i	   |  i
 i  f  n |  i d	 d0  |  i d	 d t i f  |  i d d d i t i  f  |  i d	 d |  i f  |  i d  y! d d k l } |  i d  Wn |  i d   n X|  i d!  |  i d"  y! d d# k l  } |  i d  Wn |  i d   n X|  i d!  |  i d$  |  i d%  t! |  |  i"  |  i d&  t! |  |  i  |  i d'  t! |  |  i#    |  i d(  t! |  |  i$    |  i d)  t! |  |  i%  |  i d*  t! |  |  i
 i#    |  i d+  t! |  |  i
 i$    |  i d,  t& |  t i'   d-  |  i d.  |  i d/  t i S(1   Nt   view_logt   rbid   s
   text/plains	   text/htmls=   <html><head><title>mod_python test page</title></head><body>
s   <h3>General information</h3>
s   <table border="1">
s:   <tr><td><code>%s</code></td><td><code>%s</code></td></tr>
s   Apache versiont   SERVER_SOFTWAREs   Apache threaded MPMs!   Yes, maximum %i threads / processs   No (single thread MPM)s   Apache forked MPMs   Yes, maximum %i processess   No (single process MPM)s   Apache server roots   Apache document rootsx   <tr><td><code>%s</code></td><td><code>%s</code> (<a href="?view_log=1" target="_new">view last 100 lines</a>)</td></tr>
s   Apache error logt   Nones   Python sys.versions8   <tr><td><code>%s</code></td><td><pre>%s</pre></td></tr>
s   Python sys.paths   
s   Python interpreter namesB   <tr><td><code>mod_python.publisher available</code></td><td><code>iĸĸĸĸ(   t	   publishert   Yest   Nos   </code></td></tr>
s<   <tr><td><code>mod_python.psp available</code></td><td><code>(   t   psps	   </table>
s   <h3>Request input headers</h3>
s   <h3>Request environment</h3>
s   <h3>Request configuration</h3>
s   <h3>Request options</h3>
s   <h3>Request notes</h3>
s   <h3>Server configuration</h3>
s   <h3>Server options</h3>
s(   <h3>Server configuration tree</h3>
<pre>i    s   </pre>
s   </body></html>(   s   Apache error logs   None((   R   t   FieldStoraget   formt   getfirstt   filet   ost   pathR   R    t   server_roott   servert   error_fnameR   R
   t   closet   content_typeR   t   OKt   add_common_varst   subprocess_envt   gett	   mpm_queryt   AP_MPMQ_IS_THREADEDt   AP_MPMQ_MAX_THREADSt   AP_MPMQ_IS_FORKEDt   AP_MPMQ_MAX_DAEMONSt   document_roott   syst   versiont   interpretert
   mod_pythonR"   R%   R   t
   headers_int
   get_configt   get_optionst   notesR   t   config_tree(   R   t   logt   linest   lineR"   R%   (    (    s:   /usr/lib/python2.5/site-packages/mod_python/testhandler.pyt   handlerH   sē    * 
	 
							*	 			(   R   R>   R    R   R;   R*   t   objectR   R   R   RG   (    (    (    s:   /usr/lib/python2.5/site-packages/mod_python/testhandler.pys   <module>   s   	
		