-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/email_message.pyc

σ
'ώDSc@@sˆdZddlmZddlmZmZmZmZmZddl	m
Zddlm
Z
ddlmZdefd„ƒYZd	S(
sAA convenience class around email.Message and email.MIMEMultipart.i(tabsolute_import(tHeadertMessaget
MIMEMultiparttMIMETexttUtils(t__version__(tsafe_unicode(tSMTPConnectiontEmailMessagecB@seZdZdd„Zddd„Zdd„ZeZdd„Zd„Z	d„Z
edddd„ƒZed	„ƒZ
ed
„ƒZRS(sfAn email message.

    The constructor needs an origin address, a destination address or addresses
    and a subject, and accepts a body as well. Add additional parts to the
    message with add_inline_attachment(). Retrieve the entire formatted message
    with as_string().

    Headers can be accessed with get() and msg[], and modified with msg[] =.
    cC@sΐi|_||_g|_t|tƒr6|g}ng}x$|D]}|j|j|ƒƒqCWdj|ƒ|jd<|j|ƒ|jd<tjt	|ƒƒ|jd<dt
|jd<dS(s|Create an email message.

        :param from_address: The origin address, to be put on the From header.
        :param to_address: The destination address of the message, to be put in
            the To header. Can also be a list of addresses.
        :param subject: The subject of the message.
        :param body: If given, the body of the message.

        All four parameters can be unicode strings or byte strings, but for the
        addresses and subject byte strings must be encoded in UTF-8. For the
        body any byte string will be accepted; if it's not ASCII or UTF-8,
        it'll be sent with charset=8-bit.
        s, tTotFromtSubjectsBazaar (%s)s
User-AgentN(t_headerst_bodyt_partst
isinstancet
basestringtappendtaddress_to_encoded_headertjoinRRt_bzrlib_version(tselftfrom_addresst
to_addresstsubjecttbodytto_addressestaddr((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pyt__init__-s			
tplaincC@sT|jdk	r7|jj|jddfƒd|_n|jj|||fƒdS(sVAdd an inline attachment to the message.

        :param body: A text to attach. Can be an unicode string or a byte
            string, and it'll be sent as ascii, utf-8, or 8-bit, in that
            preferred order.
        :param filename: The name for the attachment. This will give a default
            name for email programs to save the attachment.
        :param mime_subtype: MIME subtype of the attachment (eg. 'plain' for
            text/plain [default]).

        The attachment body will be displayed inline, so do not use this
        function to attach binary attachments.
        RN(RtNoneRR(RRtfilenametmime_subtype((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pytadd_inline_attachmentLscC@sI|jsRtjƒ}|jdk	r|j|jƒ\}}|j||ƒqn½tjƒ}|dk	rz|j|ƒnx’|jD]‡\}}}|j|ƒ\}}tj|||ƒ}|dk	rτ|d}|d|7}|j	d|ƒnd|d<|j
|ƒq„Wx-t|jj
ƒƒD]\}	}
|
||	<q%W|jƒS(s¦Return the entire formatted message as a string.

        :param boundary: The boundary to use between MIME parts, if applicable.
            Used for tests.
        sContent-Types; name="%s"tinlinesContent-DispositionN(RRRRtstring_with_encodingtset_payloadRtset_boundaryRtreplace_headertattachtsortedR
titemst	as_string(RtboundarytmsgobjRtencodingR R!tpayloadtcontent_typetheadertvalue((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pyR+bs(	

"cC@s|jj||ƒS(s@Get a header from the message, returning failobj if not present.(R
tget(RR1tfailobj((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pyR3‡scC@s|jj|dƒS(sΐGet a header from the message, returning None if not present.

        This method intentionally does not raise KeyError to mimic the behavior
        of __getitem__ in email.Message.
        N(R
R3R(RR1((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pyt__getitem__‹scC@s|jj||ƒS(N(R
t__setitem__(RR1R2((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pyR6“sc	C@sNt||||ƒ}|dk	r7|j|||ƒnt|ƒj|ƒdS(sCreate an email message and send it with SMTPConnection.

        :param config: config object to pass to SMTPConnection constructor.

        See EmailMessage.__init__() and EmailMessage.add_inline_attachment()
        for an explanation of the rest of parameters.
        N(R	RR"Rt
send_email(	tconfigRRRRt
attachmenttattachment_filenametattachment_mime_subtypetmsg((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pytsend–s


cC@sKtj|ƒ\}}|s|Stjttjt|ƒƒƒ|fƒSdS(s¦RFC2047-encode an address if necessary.

        :param address: An unicode string, or UTF-8 byte string.
        :return: A possibly RFC2047-encoded string.
        N(Rt	parseaddrt
formataddrtstrRR(taddresstusertemail((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pyR¦s
	cC@sΆt|tƒrMy|jdƒdfSWq²tk
rI|jdƒdfSXney|jdƒ|dfSWnGtk
r±y|jdƒ|dfSWq²tk
r­|dfSXnXdS(sπReturn a str object together with an encoding.

        :param string\_: A str or unicode object.
        :return: A tuple (str, encoding), where encoding is one of 'ascii',
            'utf-8', or '8-bit', in that preferred order.
        tasciisutf-8s8-bitN(RtunicodetencodetUnicodeEncodeErrortdecodetUnicodeDecodeError(tstring_((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pyR$Άs





N(t__name__t
__module__t__doc__RRR"R+t__str__R3R5R6tstaticmethodR=RR$(((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pyR	"s	#		N(RMt
__future__RRCRRRRRtbzrlibRRtbzrlib.osutilsRtbzrlib.smtp_connectionRtobjectR	(((s8/usr/lib/python2.7/dist-packages/bzrlib/email_message.pyt<module>s(

Copyright © 2017 || Recoded By Mr.Bumblebee