ó
}cAc           @   s-   d  Z  d d l m Z d d d     YZ d S(   s}    SimplePageFormatter class
    If you want to implement new PageFormatter: extend this class and create new getpage method. 
i˙˙˙˙(   t   Configt   SimplePageFormatterc           B   s    e  Z d  Z d   Z d   Z RS(   sÁ   The most simple Wiki page formatting taken from wypy
       'DataStore', 'ContentFormatter' and 'encoding' objects must be added to Config before,
       instanciating object of this class
    c         C   s:   t  j d  |  _ t  j d  |  _ t  j d  |  _ d S(   s°   Initilize PageFormatter
           'DataStore', 'ContentFormatter' and 'encoding' objects must be added to Config before,
           instanciating object of this class
        t	   DataStoret   ContentFormattert   encodingN(   R    t   gett	   datastoret	   formatterR   (   t   self(    (    s%   lib/medus/page/SimplePageFormatter.pyt   __init__   s    c      
   C   s   | j  d  p d } | d } i d | | |  j j |  j j |   pL | f d 6d | |  j j |  | |  j j |  p d | f d 6j  |  S(   sV   fields - dict of HTTP pears. Returns formatted page string, according to fields['job']t   jobt   viewt   wns?   <h1>Wiki:%s</h1> (<a href=?wn=%s&amp;job=edit>edit me</a>)<p>%ssż   <form action=?%s method=POST><h1>%s<input type=hidden name=wn value=%s><input type=hidden name=form value=save><input type=submit></h1><textarea name=text rows=15 cols=80>%s</textarea></form>s   Describe %st   edit(   R   R   t   formatR   t   read(   R   t   fieldsR
   R   (    (    s%   lib/medus/page/SimplePageFormatter.pyt   getpage   s    
/9(   t   __name__t
   __module__t   __doc__R	   R   (    (    (    s%   lib/medus/page/SimplePageFormatter.pyR      s   		N(    (   R   t	   medus.cfgR    R   (    (    (    s%   lib/medus/page/SimplePageFormatter.pyt   <module>   s   