łň
łĹFc           @   sM   d  d k  Z  d  d k Z d  d k Z d  d k Z d Z d d d     YZ d S(   i˙˙˙˙Nt    t   CGIc           B   s\   e  Z g  d   Z d   Z d   Z d d  Z d d d  Z d   Z d	   Z d
   Z	 RS(   c         C   s   d |  _  |  i   |  _ t |  _ |  i   y |  i   WnZ t j
 o nI t j
 o< } |  i	   d GHd | GHd d k
 } | i   d GHn Xd S(   s)   Initialize variables and run this script.i    s   

<pre>s   Exception: %si˙˙˙˙Ns   </pre>(   t   printedHeadert   getWorkingDirt
   workingDirt   PROGRAM_NAMEt   programNamet   setContextFromEnvironmentt   runt
   SystemExitt	   Exceptiont   printHeadert	   tracebackt	   print_exc(   t   selft   varst   argR   (    (    s-   /home/leonardr/public_html/cgi-bin/msm/CGI.pyt   __init__   s    		

	
c         C   sw   d } t  t i  o] t i d } t i | d  } | d j o- | | d  } t i i t i   |  } qs n | S(   s*   Get the working directory for this script.s   ./i    t   /i   (	   t   lent   syst   argvt   stringt   rfindt   ost   patht   joint   getcwd(   R   R   t   invokedt   it	   extraPath(    (    s-   /home/leonardr/public_html/cgi-bin/msm/CGI.pyR      s    #c         C   sű   d |  _  d  |  _ d  |  _ xŤ d d g D] } |  i  p t i i | d  } t i | d  } | d j oU | d j o t i	 | | d d  d	 j o& | | d  |  _  | | d |  _ qĹ q( q( W|  i  p d
 |  _  n |  i p d |  _ n d  S(   Ns   /cgi-bin/msm/t   SCRIPT_NAMEt   _R    R   i˙˙˙˙i   t   pythoni    s   /msm/s   map.cgi(
   t   baseURLt   Nonet
   scriptNamet   hostR   t   environt   getR   R   t   find(   R   t   varR   R   (    (    s-   /home/leonardr/public_html/cgi-bin/msm/CGI.pyR   +   s    			 
<

s	   text/htmlc         C   s$   |  i  p d | GHd |  _  n d  S(   Ns   Content-type: %s
i   (   R   (   R   t   type(    (    s-   /home/leonardr/public_html/cgi-bin/msm/CGI.pyR   C   s    
	R    i    c         C   sU   |  i    | o |  i d | } n
 |  i } d GHd | GH| o d | GHn d  S(   Ns   : sq   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/transitional.dtd">s*   <html><head><title>%s</title></head><body>s   <h1>%s</h1>(   R   R   (   R   t   titlet   printTitleAsHeader(    (    s-   /home/leonardr/public_html/cgi-bin/msm/CGI.pyt	   startPageH   s    
		c         C   s	   d GHd  S(   Ns   </body></html>(    (   R   (    (    s-   /home/leonardr/public_html/cgi-bin/msm/CGI.pyt   endPageS   s    c         C   s.   |  i  d  d | GH|  i   t i   d  S(   Nt   Errors   <h1>Error: %s</h1>(   R-   R.   R   t   exit(   R   t   error(    (    s-   /home/leonardr/public_html/cgi-bin/msm/CGI.pyR1   V   s    	
c         C   s    |  i  d  d GH|  i   d S(   s   Override this in a subclass.s   Nothing HappenssM   You instantiated CGI directly, or you didn't override run() in your subclass.N(   R-   R.   (   R   (    (    s-   /home/leonardr/public_html/cgi-bin/msm/CGI.pyR   \   s    (
   t   __name__t
   __module__R   R   R   R   R-   R.   R1   R   (    (    (    s-   /home/leonardr/public_html/cgi-bin/msm/CGI.pyR   
   s   				(    (   R   t   reR   R   R   R   (    (    (    s-   /home/leonardr/public_html/cgi-bin/msm/CGI.pys   <module>   s
   