ó
5 PTc           @   sß   d  Z  d d l m Z m Z m Z m Z m Z m Z d d l m	 Z
 m Z d d l m Z d d l Z d d l m Z d d l m Z m Z d d l m Z d d	 l m Z d d
 l m Z d g Z d e f d „  ƒ  YZ d S(   s   Main Controlleriÿÿÿÿ(   t   exposet   flasht   requiret   urlt   requestt   redirect(   t   ugettextt   lazy_ugettext(   t
   predicatesN(   t   BaseController(   t	   DBSessiont   metadata(   t   ErrorController(   t   model(   t   SecureControllert   RootControllerc           B   sò   e  Z d  Z e ƒ  Z e j ƒ  Z e j	 d d e
 d ƒ ƒe _ e j ƒ  Z e j ƒ  Z e ƒ  d „  ƒ Z e ƒ  d „  ƒ Z e ƒ  Z e d ƒ d „  ƒ Z e d ƒ d	 „  ƒ Z e d
 ƒ d d „ ƒ Z e ƒ  d d „ ƒ Z e ƒ  d d „ ƒ Z RS(   s¨  
    The root controller for the Monkey application.
    
    All the other controllers and WSGI applications should be mounted on this
    controller. For example::
    
        panel = ControlPanelController()
        another_app = AnotherWSGIApplication()
    
    Keep in mind that WSGI applications shouldn't be mounted directly: They
    must be wrapped around with :class:`tg.controllers.WSGIAppController`.
    
    u   Admint   msgs"   Only Admins can edit this website!c         G   s   |  j  | f S(   N(   t   _default(   t   selft	   remainder(    (    s=   /mit/sca/Scripts/turbogears/Monkey/monkey/controllers/root.pyt   _lookup+   s    c         C   s   |  j  j  ƒ  S(   N(   R   (   R   (    (    s=   /mit/sca/Scripts/turbogears/Monkey/monkey/controllers/root.pyt   index.   s    s   monkey.templates.aboutc         C   s   t  d d ƒ S(   s   Handle the 'about' page.t   paget   about(   t   dict(   R   (    (    s=   /mit/sca/Scripts/turbogears/Monkey/monkey/controllers/root.pyR   4   s    s   monkey.templates.authenticationc         C   s   t  d d ƒ S(   s9   Display some information about auth* on this application.R   t   auth(   R   (   R   (    (    s=   /mit/sca/Scripts/turbogears/Monkey/monkey/controllers/root.pyR   9   s    s   monkey.templates.logint   /c         C   sN   t  j d } | d k r/ t t d ƒ d ƒ n  t d d d t | ƒ d | ƒ S(	   s   Start the user login.s   repoze.who.loginsi    s   Wrong credentialst   warningR   t   logint   login_countert	   came_from(   R   t   environR   t   _R   t   str(   R   R   R   (    (    s=   /mit/sca/Scripts/turbogears/Monkey/monkey/controllers/root.pyR   >   s
    c         C   sb   t  j s3 t  j d d } t d d | d | ƒn  t  j d } t t d ƒ | ƒ t | ƒ d S(	   s©   
        Redirect the user to the initially requested page on successful
        authentication or redirect her back to the login page if login failed.
        
        s   repoze.who.loginsi   s   /loginR   t   __loginss   repoze.who.userids   Welcome back, %s!N(   R   t   identityR   R   R   R    (   R   R   R   t   userid(    (    s=   /mit/sca/Scripts/turbogears/Monkey/monkey/controllers/root.pyt
   post_loginG   s    	c         C   s   t  t d ƒ ƒ t | ƒ d S(   sw   
        Redirect the user to the initially requested page on logout and say
        goodbye as well.
        
        s   We hope to see you soon!N(   R   R    R   (   R   R   (    (    s=   /mit/sca/Scripts/turbogears/Monkey/monkey/controllers/root.pyt   post_logoutU   s    (   t   __name__t
   __module__t   __doc__R   t   secct   bazkit   Editt   editR   t   in_any_groupt   l_t
   allow_onlyt   GetterR   t   StaticR    R   R   R   t   errorR   R   R   R%   R&   (    (    (    s=   /mit/sca/Scripts/turbogears/Monkey/monkey/controllers/root.pyR      s$   			(   R)   t   tgR    R   R   R   R   R   t   pylons.i18nR   R    R   R/   t   repoze.whatR   R+   t   monkey.lib.baseR	   t   monkey.modelR
   R   t   monkey.controllers.errorR   t   monkeyR   t   monkey.controllers.secureR   t   __all__R   (    (    (    s=   /mit/sca/Scripts/turbogears/Monkey/monkey/controllers/root.pyt   <module>   s   .	