[New-bugs-announce] [issue22535] headerregistry.Address introduces extra quotes without addr_spec parameter

Kristian Rother report at bugs.python.org
Wed Oct 1 23:25:24 CEST 2014


New submission from Kristian Rother:

I am trying to create an email address as in the Python doc example 
https://docs.python.org/3/library/email-examples.html

The example does not work as given on the page.

I tried Python 3.4rc1 and the 3.5 compiled from source on Ubuntu 12.

I found two possible reasons:

1) Python bug in headerregistry.py
The string resulting from the command below contains extra quotes:

str(Address('Foo Example', 'foo at example.com'))
--> 'Foo Example <"foo at example.com">'


2) Documentation bug

The documentation of headerregistry.Address states:

"username and domain may be specified together by using 
the addr_spec keyword *instead of* the username and domain keywords"

However, this is inconsistent with example 19.1.14.1. on
https://docs.python.org/3/library/email-examples.html

Attached are two tests that reproduce the situation.
The first test below fails but the second passes.

Conclusion:
In my opinion, it is more intuitive if the following would work as well:
Address('Foo Example', 'foo at example.com')

----------
components: email
files: test_email_address_with_quotes.py
messages: 228128
nosy: barry, krother, r.david.murray
priority: normal
severity: normal
status: open
title: headerregistry.Address introduces extra quotes without addr_spec parameter
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file36769/test_email_address_with_quotes.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22535>
_______________________________________


More information about the New-bugs-announce mailing list