1
  "   'lze8] \i1hh      '128
  "   )li~d
e821hh      )0x0000000000000000
  "   +lad*j"Tҁ5qţBg 	w    +
Oc           @   s   d  Z  d Z d Z d Z d Z d Z d Z d d l Z d d	 l m	 Z	 m
 Z
 m Z m Z m Z m Z m Z m Z m Z d d
 l m Z e j e  Z d   Z d S(   sT   urllib2 style build opener integrates with HTTPSConnection class from this
package.
s   P J Kershaws   21/12/10s2   (C) 2011 Science and Technology Facilities Councils-   BSD - see LICENSE file in top-level directorys   Philip.Kershaw@stfc.ac.uks   $Id$iN(	   t   ProxyHandlert   UnknownHandlert   HTTPDefaultErrorHandlert
   FTPHandlert   FileHandlert   HTTPErrorProcessort   HTTPHandlert   OpenerDirectort   HTTPRedirectHandler(   t   HTTPSContextHandlerc             sk  d d l      f d   } t   } t t t t t t t t	 g } t
 |  } | j t  g  } xl | D]d } x[ |  D]S } | |  r t | |  r | j |  q qu t | |  ru | j |  qu qu Wqh Wx- | D]% } | | k r | j |    q q W| j d  }	 t | k r1| j t |	   n  x3 |  D]+ }
 | |
  rV|
   }
 n  | j |
  q8W| S(   s  Create an opener object from a list of handlers.

    The opener will use several default handlers, including support
    for HTTP and FTP.

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
    iNc            s   t  |    j  p t |  d  S(   Nt	   __bases__(   t
   isinstancet	   ClassTypet   hasattr(   t   obj(   t   types(    sH   /usr/lib/python2.7/site-packages/ndg/httpsclient/urllib2_build_opener.pyt   isclass   s    t   ssl_context(   R   R   R    R   R   R   R   R   R   R   t   listt   appendR	   t
   issubclassR   t   add_handlert   get(   t   handlerst   kwR   t   openert   default_classest   check_classest   skipt   klasst   checkR   t   h(    (   R   sH   /usr/lib/python2.7/site-packages/ndg/httpsclient/urllib2_build_opener.pyt   build_opener   s6    			(   t   __doc__t
   __author__t   __date__t   __copyright__t   __license__t   __contact__t   __revision__t   loggingt   urllib2R    R   R   R   R   R   R   R   R   t   ndg.httpsclient.httpsR	   t	   getLoggert   __name__t   logR    (    (    (    sH   /usr/lib/python2.7/site-packages/ndg/httpsclient/urllib2_build_opener.pyt   <module>   s   @     -i     -#! /usr/bin/env python

# View a single MIME multipart message.
# Display each part as a box.

import string
from types import *
from Tkinter import *
from ScrolledText import ScrolledText

class MimeViewer:
    def __init__(self, parent, title, msg):
        self.title = title
        self.msg = msg
        self.frame = Frame(parent, {'relief': 'raised', 'bd': 2})
        self.frame.packing = {'expand': 0, 'fill': 'both'}
        self.button = Checkbutton(self.frame,
                             {'text': title,
                              'command': self.toggle})
        self.button.pack({'anchor': 'w'})
        headertext = msg.getheadertext(
                lambda x: x != 'received' and x[:5] != 'x400-')
        height = countlines(headertext, 4)
        if height:
            self.htext = ScrolledText(self.frame,
                              {'height': height,
                               'width': 80,
                               'wrap': 'none',
                               'relief': 'raised',
                               'bd': 2})
            self.htext.packing = {'expand': 1, 'fill': 'both',
                                  'after': self.button}
            self.htext.insert('end', headertext)
        else:
            self.htext = Frame(self.frame,
                               {'relief': 'raised', 'bd': 2})
            self.htext.packing = {'side': 'top',
                                  'ipady': 2,
                  