%PDF- %PDF-
| Direktori : /opt/plesk/python/2.7/lib/python2.7/site-packages/dns/ |
| Current File : //opt/plesk/python/2.7/lib/python2.7/site-packages/dns/exception.pyc |
�
�ac @ s� d Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d
� � YZ d e f d � � YZ d
S( s� Common DNS Exceptions.
Dnspython modules may also define their own exceptions, which will
always be subclasses of ``DNSException``.
t DNSExceptionc B sP e Z d Z d Z e � Z d Z d � Z d � Z d � Z
d � Z d � Z RS( s� Abstract base class shared by all dnspython exceptions.
It supports two basic modes of operation:
a) Old/compatible mode is used if ``__init__`` was called with
empty *kwargs*. In compatible mode all *args* are passed
to the standard Python Exception class as before and all *args* are
printed by the standard ``__str__`` implementation. Class variable
``msg`` (or doc string if ``msg`` is ``None``) is returned from ``str()``
if *args* is empty.
b) New/parametrized mode is used if ``__init__`` was called with
non-empty *kwargs*.
In the new mode *args* must be empty and all kwargs must match
those set in class variable ``supp_kwargs``. All kwargs are stored inside
``self.kwargs`` and used in a new ``__str__`` implementation to construct
a formatted message based on the ``fmt`` class variable, a ``string``.
In the simplest case it is enough to override the ``supp_kwargs``
and ``fmt`` class variables to get nice parametrized messages.
c O s� | j | | � | r: | j | � | _ t | � | _ n t � | _ | j d k rd | j | _ n | r� t t | � j
| � n t t | � j
| j � d S( N( t
_check_paramst
_check_kwargst kwargst strt msgt dictt Nonet __doc__t superR t __init__( t selft argsR ( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/dns/exception.pyR
3 s c O s7 | s | r3 t | � t | � k s3 t d � � n d S( ss Old exceptions supported only args and not kwargs.
For sanity we do not allow to mix old and new behavior.s= keyword arguments are mutually exclusive with positional argsN( t boolt AssertionError( R R R ( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/dns/exception.pyR B s c K s; | r7 t | j � � | j k s7 t d | j � � n | S( Ns- following set of keyword args is required: %s( t sett keyst supp_kwargsR ( R R ( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/dns/exception.pyR J s
c K s� i } x� | j � D]t \ } } t | t t f � r} t t t | � � | | <t | | � d k r� | | j � | | <q� q | | | <q W| S( s� Format kwargs before printing them.
Resulting dictionary has to have keys necessary for str.format call
on fmt class variable.
i ( t itemst
isinstancet listR t mapR t lent pop( R R t fmtargst kwt data( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/dns/exception.pyt _fmt_kwargsQ s c C sK | j r4 | j r4 | j | j � } | j j | � St t | � j � Sd S( N( R t fmtR t formatR R t __str__( R R ( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/dns/exception.pyR c s N(
t __name__t
__module__R R R R R R R
R R R R ( ( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/dns/exception.pyR s t FormErrorc B s e Z d Z RS( s DNS message is malformed.( R R R ( ( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/dns/exception.pyR! m s t SyntaxErrorc B s e Z d Z RS( s Text input is malformed.( R R R ( ( ( sB /opt/plesk/python/2.7/lib/python2.7/site-packages/dns/exception.pyR"