[XML-SIG] Deep copy of an element from one document to another
Barry A. Warsaw
barry@wooz.org
Wed, 19 Jun 2002 22:32:56 -0400
>>>>> "UO" == Uche Ogbuji <uche.ogbuji@fourthought.com> writes:
UO> Hmm. Color me slow :-)
UO> I see nothing in Lib/email/Iterators.py itself. And just in
UO> case, I tried loading it with python 1.5 and got the expected
UO> blow-up.
UO> So I assume you mean something more devious than code.
UO> Barry got his utility functions packaged with Python so that
UO> he could just ship portable code, which would try to import
UO> these souped-up functions, and fall back to pre-iterator forms
UO> if not available?
Fred's probably talking about Iterators.py in cvs, which is
essentially just this:
-------------------- snip snip --------------------
try:
from email._compat22 import body_line_iterator, typed_subpart_iterator
except SyntaxError:
# Python 2.1 doesn't have generators
from email._compat21 import body_line_iterator, typed_subpart_iterator
-------------------- snip snip --------------------
Note that email._compat22.body_line_iterator has a yield statement in
it, make it a Python 2.2-only generator.
I only support Python 2.1 and beyond, so it will definitely raise an
exception with Python 1.5, but I think the concept would hold.
Whether this is a good idea or not is another story, but I wanted the
email package to be both part of the Python distro, and a separate
distutils package compatible with Python 2.1.
UO> If so, Barry gets my Daily Machination Award ;-)
Just be sure to spell my name right. That's Barry "Bank Boy" Warsaw.
:)
-Barry