mς &U²Ic@sVdZdkZdklZd„Zed„Zddd„Zdded„Z dS( s1Various types of useful iterators and generators.N(sStringIOccsK|V|iƒo6x3|iƒD]!}x|iƒD] }|Vq1WqWndS(s‰Walk over the message tree, yielding each subpart. The walk is performed in depth-first order. This method is a generator. N(tselft is_multipartt get_payloadtsubparttwalkt subsubpart(RRR((t,/data/zmath/lib/python2.4/email/Iterators.pyR s   ccs\xU|iƒD]G}|id|ƒ}t|tƒoxt|ƒD] }|VqBWq q WdS(sŽIterate over the parts, returning string payloads line-by-line. Optional decode (default False) is passed through to .get_payload(). tdecodeN( tmsgRRRRtpayloadt isinstancet basestringtStringIOtline(RRRR R ((Rtbody_line_iterators  ttextccsZxS|iƒD]E}|iƒ|jo,|djp|iƒ|jo|VqRq q WdS(sψIterate over the subparts with a given MIME type. Use `maintype' as the main MIME type to match against; this defaults to "text". Optional `subtype' is the MIME subtype to match against; if omitted, only the main type is matched. N(RRRtget_content_maintypetmaintypetsubtypetNonetget_content_subtype(RRRR((Rttyped_subpart_iterator)s   ic Cs’|djo ti}nd|d}|||iƒI|o|d|i ƒIJn|J|i ƒo2x/|i ƒD]}t |||d|ƒqyWndS(sA handy debugging aidt is[%s]iN(tfpRtsyststdouttlevelttabRtget_content_typetinclude_defaulttget_default_typeRRRt _structure(RRRRRR((RR7s    ( t__doc__Rt cStringIOR RtFalseRRRR(RRR RRR((Rt?s