Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email.policy doc example passes 'policy' to as_string, but that doesn't work #62800

Closed
bitdancer opened this issue Jul 30, 2013 · 4 comments
Closed
Labels
docs Documentation in the Doc dir topic-email type-bug An unexpected behavior, bug, or error

Comments

@bitdancer
Copy link
Member

BPO 18600
Nosy @warsaw, @bitdancer
Files
  • as_string_policy.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2013-08-09.20:22:20.859>
    created_at = <Date 2013-07-30.15:19:20.951>
    labels = ['type-bug', 'expert-email', 'docs']
    title = "email.policy doc example passes 'policy' to as_string, but that doesn't work"
    updated_at = <Date 2013-08-09.20:22:20.858>
    user = 'https://github.com/bitdancer'

    bugs.python.org fields:

    activity = <Date 2013-08-09.20:22:20.858>
    actor = 'r.david.murray'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2013-08-09.20:22:20.859>
    closer = 'r.david.murray'
    components = ['Documentation', 'email']
    creation = <Date 2013-07-30.15:19:20.951>
    creator = 'r.david.murray'
    dependencies = []
    files = ['31209']
    hgrepos = []
    issue_num = 18600
    keywords = ['patch']
    message_count = 4.0
    messages = ['193937', '194759', '194766', '194767']
    nosy_count = 4.0
    nosy_names = ['barry', 'r.david.murray', 'docs@python', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue18600'
    versions = ['Python 3.3', 'Python 3.4']

    @bitdancer
    Copy link
    Member Author

    When I wrote those docs I intended to add a policy argument to as_string, but did not do it by the time 3.3 was released. The docs for 3.3 need to be corrected, and I need to decide if I do want to add that keyword to as_string in 3.4 (the answer is probably yes, but I may check with the email-sig first).

    @bitdancer bitdancer added docs Documentation in the Doc dir topic-email type-bug An unexpected behavior, bug, or error labels Jul 30, 2013
    @bitdancer
    Copy link
    Member Author

    Turns out even with as_string accepting a policy keyword, the example still failed. It needs to be generating a bytes object, not a string. Before I even realized that, though, I decided I wanted to add as_bytes (and __bytes__). So the attached patch does that: adds policy to as_string, and adds new methods as_bytes and __bytes__ to Message.

    This patch is only for 3.4. The 3.3 patch will just delete that part of the policy example, so I'm not going to bother to upload it.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 9, 2013

    New changeset 53287858e71f by R David Murray in branch 'default':
    bpo-18600: add policy to add_string, and as_bytes and __bytes__ methods.
    http://hg.python.org/cpython/rev/53287858e71f

    New changeset 8fbaf4e649af by R David Murray in branch '3.3':
    bpo-18600: In 3.3, as_string does not accept a policy keyword.
    http://hg.python.org/cpython/rev/8fbaf4e649af

    New changeset b9a5b7e3b32f by R David Murray in branch 'default':
    Null merge related to bpo-18600.
    http://hg.python.org/cpython/rev/b9a5b7e3b32f

    @bitdancer
    Copy link
    Member Author

    Committed with changes pointed out by Antoine (thank you Antoine).

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir topic-email type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant