[Python-bugs-list] [ python-Feature Requests-494034 ] a smarter rfc822.dump_address_pair()
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 07 Mar 2002 10:07:04 -0800
Feature Requests item #494034, was opened at 2001-12-16 18:24
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=494034&group_id=5470
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jason R. Mastaler (jasonrm)
Assigned to: Barry Warsaw (bwarsaw)
Summary: a smarter rfc822.dump_address_pair()
Initial Comment:
Please see:
http://mail.python.org/pipermail/python-list/2001-December/075881.html
I'm turning this into a feature request since
I didn't get any responses on comp.lang.python.
----------------------------------------------------------------------
>Comment By: Jason R. Mastaler (jasonrm)
Date: 2002-03-07 11:07
Message:
Logged In: YES
user_id=85984
Yes, I think formataddr() is a much better
name. dump_address_pair() is not very intuitive
at all IMO.
----------------------------------------------------------------------
Comment By: Barry Warsaw (bwarsaw)
Date: 2002-03-07 10:49
Message:
Logged In: YES
user_id=12800
Oh, and how motivated would you be to writing a new
implementation of parseaddr()? <wink>.
There are two problems with the one from rfc822.py. First,
we've got the ugly workaround for a bug in older versions
(where realname='' and emailaddr=None). Second, it has a
nasty bug when the email address contains embedded spaces:
it collapses the spaces:
>>> from email.Utils import parseaddr
>>> parseaddr('foo bar@wooz.org')
('', 'foobar@wooz.org')
>>> parseaddr('<foo bar@wooz.org>')
('', 'foobar@wooz.org')
Boo, hiss. Of course parseaddr() would be more involved to
implement in an RFC 2822 compliant way, but it would be very
cool.
----------------------------------------------------------------------
Comment By: Barry Warsaw (bwarsaw)
Date: 2002-03-07 10:45
Message:
Logged In: YES
user_id=12800
I'd like to gradually reduce the dependence on rfc822.py so
please write the new implementation for email.Utils. This
is exactly the route taken for formatdate().
Also, let's come up with a better name than
dump_address_pairs(). We have a parsedate() and a
formatdate(). We've got a parseaddr() so what do you think
about formataddr()? We can keep dump_address_pairs as a
back-compat alias.
----------------------------------------------------------------------
Comment By: Jason R. Mastaler (jasonrm)
Date: 2002-03-07 10:40
Message:
Logged In: YES
user_id=85984
I'd like to take a shot at coding a better
dump_address_pair method. Before I start, should
the diff be against rfc822 or email.Utils? (which
currently just imports dump_address_pair from
rfc822). Perhaps a new implementation like this
should just go into email, and
rfc822.dump_address_pair() can just be left as is,
similar to how the formatdate method was
reimplemented for email.
Let me know what you think.
----------------------------------------------------------------------
Comment By: Barry Warsaw (bwarsaw)
Date: 2001-12-17 15:41
Message:
Logged In: YES
user_id=12800
If you get to it before I do, upload it here... :)
----------------------------------------------------------------------
Comment By: Jason R. Mastaler (jasonrm)
Date: 2001-12-17 15:28
Message:
Logged In: YES
user_id=85984
Thanks Barry. If you don't think you'll have time to
write the code for this, I can try and work on a patch.
----------------------------------------------------------------------
Comment By: Barry Warsaw (bwarsaw)
Date: 2001-12-17 08:04
Message:
Logged In: YES
user_id=12800
Claiming this item. There appears to be no groups set for
the feature request tracker, but I'll look at this for
Python 2.3 (to late to add it to Python 2.2).
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=494034&group_id=5470