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', 'f...@example.com'))
--> 'Foo Example <"f...@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', 'f...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue22535>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to