ó
ú2ec           @   s   d  Z  d d l Z d d g Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z e j  e _  d d	 e d
 „ Z e j  e _  d S(   s5   
Various Applications for Debugging/Testing Purposes
iÿÿÿÿNt   SimpleApplicationt   SlowConsumerc           B   s   e  Z d  Z d „  Z RS(   s$   
    Produces a simple web page
    c         C   s2   d } | d d d t  t | ƒ ƒ f g ƒ | g S(   Ns    <html><body>simple</body></html>s   200 OKs   Content-Types	   text/htmls   Content-Length(   s   Content-Types	   text/html(   t   strt   len(   t   selft   environt   start_responset   body(    (    s>   /usr/local/lib/python2.7/dist-packages/paste/debug/debugapp.pyt   __call__   s    	(   t   __name__t
   __module__t   __doc__R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/paste/debug/debugapp.pyR       s   c           B   s)   e  Z d  Z d d e d „ Z d „  Z RS(   sž   
    Consumes an upload slowly...

    NOTE: This should use the iterator form of ``wsgi.input``,
          but it isn't implemented in paste.httpserver.
    i   i   c         C   s   | |  _  | |  _ t |  _ d  S(   N(   t
   chunk_sizet   delayt   Truet   progress(   R   R   R   R   (    (    s>   /usr/local/lib/python2.7/dist-packages/paste/debug/debugapp.pyt   __init__    s    		c         C   s  d } | j  d ƒ } | rÝ t | ƒ } x¦ | d k rÏ |  j rQ d | | f GHn  | d k rs | d j d ƒ } n | d j | ƒ } | s Pn  | t | ƒ 7} | t | ƒ 8} |  j r* t j |  j ƒ q* q* Wd | } n d } d GH| d	 d d t t | ƒ ƒ f g ƒ | g S(   Ni    t   CONTENT_LENGTHs   %s of %s remainingi   s
   wsgi.inputs"   <html><body>%d bytes</body></html>s   <html><body>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" >
</form></body></html>
t   bingless   200 OKs   Content-Types	   text/htmls   Content-Length(   s   Content-Types	   text/html(	   t   gett   intR   t   readR   R   t   timet   sleepR   (   R   R   R   t   sizet   totalt	   remainingt   chunkR   (    (    s>   /usr/local/lib/python2.7/dist-packages/paste/debug/debugapp.pyR   %   s,    			(   R	   R
   R   R   R   R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/paste/debug/debugapp.pyR      s   c         C   s   t  ƒ  S(   N(   R    (   t   global_conf(    (    s>   /usr/local/lib/python2.7/dist-packages/paste/debug/debugapp.pyt   make_test_appC   s    i   i   c         C   s;   d d l  m } t d t | ƒ d t | ƒ d | | ƒ ƒ S(   Niÿÿÿÿ(   t   asboolR   R   R   (   t   paste.deploy.convertersR   R   R   (   R   R   R   R   R   (    (    s>   /usr/local/lib/python2.7/dist-packages/paste/debug/debugapp.pyt   make_slow_appH   s
    (	   R   R   t   __all__t   objectR    R   R   R   R    (    (    (    s>   /usr/local/lib/python2.7/dist-packages/paste/debug/debugapp.pyt   <module>	   s   
*	