ó
‚•oTc           @   s>   d  d l  Z  d  d l Z d  d l Z d e f d „  ƒ  YZ d S(   iÿÿÿÿNt   Checkerc           B   só   e  Z e Z d  „  Z d „  Z d  d „ Z e Z	 d „  Z
 d „  Z d „  Z i
 d d 6d d	 6d  d
 6d d 6d  d 6d d 6d d 6d d 6d d 6d d 6Z i  Z d „  Z d „  Z g  Z d „  Z d „  Z i  Z d „  Z d „  Z d „  Z d „  Z RS(!   c         C   s   |  j  ƒ  d  S(   N(   t   _populate_known_types(   t   self(    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   __init__   s    c         C   sŠ   |  j  r† t j } |  j t _ zX xQ t |  ƒ D]C } | j d ƒ r. t |  | ƒ } | rq t | ƒ rq | ƒ  qq q. q. WWd  | t _ Xn  d  S(   Nt   check_(   t   ont   warningst   formatwarningt   dirt
   startswitht   getattrt   callable(   R   t   oldformatwarningt   namet   method(    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   __call__   s    		c         C   s   d | S(   Ns   CherryPy Checker:
%s

(    (   R   t   messaget   categoryt   filenamet   linenot   line(    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyR   *   s    c         C   sÚ   xÓ t  j j j ƒ  D]¿ \ } } t | t  j ƒ s7 q n  | j sF q n  | d k rX q n  | j d ƒ j d ƒ } x_ | j j	 ƒ  D]N } | j d ƒ j d ƒ } | t
 | ƒ  | k r€ t j d | | f ƒ q€ q€ Wq Wd  S(   Nt    t   /sT   The application mounted at %r has config entries that start with its script name: %r(   t   cherrypyt   treet   appst	   iteritemst
   isinstancet   Applicationt   configt   stript   splitt   keyst   lenR   t   warn(   R   t   snt   appt   sn_atomst   keyt	   key_atoms(    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt4   check_app_config_entries_dont_start_with_script_name1   s    	c         C   sy   xr t  j j j ƒ  D]^ \ } } t | t  j ƒ s7 q n  | j s d | } |  j r` | d 7} n  t j	 | ƒ d  Sq Wd  S(   Ns2   The Application mounted at %r has an empty config.sÄ    It looks like the config you passed to cherrypy.config.update() contains application-specific sections. You must explicitly pass application config via cherrypy.tree.mount(..., config=app_config)(
   R   R   R   R   R   R   R   t   global_config_contained_pathsR   R"   (   R   R#   R$   t   msg(    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   check_skipped_app_configA   s    	
	c         C   sÙ  t  j } xÉt  j j j ƒ  D]µ\ } } t | t  j ƒ s@ q n  | | _ x…| j D]z} | j	 | d ƒ | j j
 } | d t ƒ rS d } | d ƒ } | d ƒ } | d  k r¸ d } nì d }	 t j j | ƒ r$| }	 | rgd } t j j | | d ƒ }
 t j j |
 ƒ r!| d	 |
 7} q!qgnC | s3d
 } n4 t j j | | ƒ }	 t j j |	 ƒ sgd |	 } n  |	 r¤t j j |	 ƒ r¤| r“| d 7} n  | d |	 7} n  | rÍt j d | | | | f ƒ qÍqS qS Wq Wd  S(   Ns   /dummy.htmls   tools.staticdir.onR   s   tools.staticdir.roots   tools.staticdir.dirs   tools.staticdir.dir is not set.s8   dir is an absolute path, even though a root is provided.i   sV   
If you meant to serve the filesystem folder at %r, remove the leading slash from dir.s,   dir is a relative path and no root provided.s   %r is not an absolute path.s   
s3   %r (root + dir) is not an existing filesystem path.s!   %s
section: [%s]
root: %r
dir: %r(   R   t   requestR   R   R   R   R   R$   R   t   get_resourcet   gett   Falset   Nonet   ost   patht   isabst   joint   existsR   R"   (   R   R,   R#   R$   t   sectiont   confR*   t   rootR   t   fulldirt   testdir(    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   check_static_pathsP   sH    					s   tools.response_headers.headerss   server.default_content_types   log.access_filet   log_access_filet   log_config_optionss   log.error_filet   log_filet   log_file_not_founds   tools.log_headers.ont   log_request_headerss
   log.screent   log_to_screens   request.show_tracebackst   show_tracebackss   request.throw_errorst   throw_errorssD   cherrypy.tree.mount(profiler.make_app(cherrypy.Application(Root())))s   profiler.onc         C   s  x| j  ƒ  D]\ } } t | t ƒ r® xã | j  ƒ  D]r \ } } | |  j k rt t j d | |  j | | f ƒ q5 | |  j k r5 t j d | |  j | | f ƒ q5 q5 Wq | |  j k rÞ t j d | |  j | f ƒ q | |  j k r t j d | |  j | f ƒ q q Wd  S(   Ns-   %r is obsolete. Use %r instead.
section: [%s]s/   %r is deprecated. Use %r instead.
section: [%s]s   %r is obsolete. Use %r instead.s!   %r is deprecated. Use %r instead.(   R   R   t   dictt   obsoleteR   R"   t
   deprecated(   R   R   R6   R7   t   kt   v(    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   _compat“   s    		"		c         C   s_   |  j  t j ƒ xH t j j j ƒ  D]4 \ } } t | t j ƒ sG q# n  |  j  | j ƒ q# Wd  S(   N(   RI   R   R   R   R   R   R   R   (   R   R#   R$   (    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   check_compatibility¨   s
    c   
      C   sÍ  d g } | j  | j j ƒ  ƒ | j  | j j ƒ  ƒ | j  | j j j ƒ  ƒ | j  t j j j ƒ  ƒ | |  j 7} xR| j j ƒ  D]A\ } } | j	 d ƒ } | r„ t
 | t ƒ r„ x| j ƒ  D]ý \ } } | j d ƒ } t | ƒ d k rÁ | d | k rh| d d k rA| d | k rAd | d j | d ƒ | f }	 n d | | d | f }	 t j |	 ƒ q¾| d d	 k r¾| d t t j ƒ k r»d
 | | d | f }	 t j |	 ƒ q»q¾qÁ qÁ Wq„ q„ Wd  S(   Nt   wsgiR   t   .i   i    R   s=   The config entry %r is invalid; try %r instead.
section: [%s]sY   The config entry %r is invalid, because the %r config namespace is unknown.
section: [%s]t   toolssT   The config entry %r may be invalid, because the %r tool was not found.
section: [%s](   t   extendt	   toolboxesR    t
   namespacest   request_classR   R   t   extra_config_namespacesR   R	   R   RD   R   R!   R4   R   R"   R   RM   (
   R   R$   t   nsR6   R7   t   is_path_sectionRG   RH   t   atomsR*   (    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt	   _known_nsµ   s0    	  c         C   sL   xE t  j j j ƒ  D]1 \ } } t | t  j ƒ s7 q n  |  j | ƒ q Wd  S(   N(   R   R   R   R   R   R   RV   (   R   R#   R$   (    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   check_config_namespacesÖ   s    c            s¯   d d  l  } g  t | ƒ j ƒ  D]$ } t | ƒ t t ƒ k r | ^ q ‰  ‡  ‡ f d †  } | t j d ƒ | t j d ƒ | t j d ƒ | t j	 d ƒ | t j
 d ƒ d  S(   Niÿÿÿÿc            sW   xP t  |  ƒ D]B } t t |  | d  ƒ ƒ } | ˆ  k r | ˆ j | d | <q q Wd  S(   NRL   (   R   t   typeR
   R0   t   known_config_types(   t   objt	   namespaceR   t   vtype(   t   builtinsR   (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   traverseé   s    R,   t   responset   servert   enginet   log(   t   __builtin__t   varst   valuesRX   t   strR   R,   R_   R`   Ra   Rb   (   R   Rc   t   xR^   (    (   R]   R   s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyR   ä   s    $c   	      C   s3  d } x&| j  ƒ  D]\ } } t | t ƒ r¶ xú | j  ƒ  D]t \ } } | d  k	 r; |  j j | d  ƒ } t | ƒ } | r¯ | | k r¯ t j | | | | j	 | j	 f ƒ q¯ q; q; Wq | | } } | d  k	 r |  j j | d  ƒ } t | ƒ } | r+| | k r+t j | | | | j	 | j	 f ƒ q+q q Wd  S(   Ns[   The config entry %r in section %r is of type %r, which does not match the expected type %r.(
   R   R   RD   R0   RY   R.   RX   R   R"   t   __name__(	   R   R   R*   R6   R7   RG   RH   t   expected_typeR\   (    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   _known_typesõ   s"    c         C   s_   |  j  t j ƒ xH t j j j ƒ  D]4 \ } } t | t j ƒ sG q# n  |  j  | j ƒ q# Wd  S(   N(   Rj   R   R   R   R   R   R   R   (   R   R#   R$   (    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   check_config_types  s
    c         C   sL   xE t  j j ƒ  D]4 \ } } | d k r | d k r t j d ƒ q q Wd  S(   Ns   server.socket_hostt	   localhosts»   The use of 'localhost' as a socket host can cause problems on newer systems, since 'localhost' can map to either an IPv4 or an IPv6 address. You should use '127.0.0.1' or '[::1]' instead.(   R   R   R   R   R"   (   R   RG   RH   (    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   check_localhost  s    N(   Rh   t
   __module__t   TrueR   R   R   R0   R   R/   R)   R(   R+   R;   RE   RF   RI   RJ   RR   RV   RW   RY   R   Rj   Rk   Rm   (    (    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyR       s<   					3
			!				(   R1   R   R   t   objectR    (    (    (    s'   /var/www/SABnzbd/cherrypy/_cpchecker.pyt   <module>   s   