� ��^c @ sk d Z d d l Z d d l Z d d l Z d d l Z d d l Z e j Z d � Z d d d � � YZ d S( s0 Wiki main program. Imported and run by cgi3.py.i����Nc C so t j � } d GHH| j d d � } | j d d � } t | � } t | d | d � p^ | j } | | � d S( Ns Content-type: text/htmlt cmdt viewt paget FrontPaget cmd_( t cgit FieldStoraget getvaluet WikiPaget getattrt Nonet cmd_view( t formR R t wikit method( ( s% /usr/lib64/python2.7/Demo/cgi/wiki.pyt main s R c B s� e Z e j � Z e j j e j d � Z d � Z d � Z d � Z d d � Z d � Z d � Z d � Z d � Z d d � Z d � Z d � Z d � Z RS( i c C s2 | j | � s t d � n | | _ | j � d S( Ns page name is not a wiki word( t iswikiwordt ValueErrort namet load( t selfR ( ( s% /usr/lib64/python2.7/Demo/cgi/wiki.pyt __init__ s c C s� d Gt | j | j � � Gd GHd GHx? | j j � D]. } | j � } | sT d GHq4 | j | � GHq4 Wd GHd G| j d | j d � d GH| j d d d � d GHd S( Ns
s
An error occurred while attempting to write the file:s
s
s/ s ?cmd=view&page=sIf nothing happens, please click here:R ( R t stripR t storeR R/ R R ( R R t errorR1 ( ( s% /usr/lib64/python2.7/Demo/cgi/wiki.pyt cmd_create@ s c C s | j | d d �d S( NR0 t Create( R2 ( R R ( ( s% /usr/lib64/python2.7/Demo/cgi/wiki.pyt cmd_newQ s c C s t j d | � S( Ns [A-Z][a-z]+([A-Z][a-z]*)+( R$ t match( R R- ( ( s% /usr/lib64/python2.7/Demo/cgi/wiki.pyR T s c C sS g } x= | D]5 } | r5 | j � r5 | j d � n | j | � q Wd j | � S( Nt R# ( t isupperR* R+ ( R R- t charst c( ( s% /usr/lib64/python2.7/Demo/cgi/wiki.pyR W s c C s2 | d k r | j } n t j j | j | d � S( Ns .txt( R R R&