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

Better error messages for wsgiref validator failures #58857

Open
Sidnicious mannequin opened this issue Apr 23, 2012 · 4 comments
Open

Better error messages for wsgiref validator failures #58857

Sidnicious mannequin opened this issue Apr 23, 2012 · 4 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@Sidnicious
Copy link
Mannequin

Sidnicious mannequin commented Apr 23, 2012

BPO 14652
Nosy @berkerpeksag, @Sidnicious
Files
  • ssm_validate.patch
  • ssm_validate.patch: Don’t use tuples when using only len() to format a string
  • issue14652.diff
  • 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 = None
    created_at = <Date 2012-04-23.17:48:02.699>
    labels = ['type-feature', 'library']
    title = 'Better error messages for wsgiref validator failures'
    updated_at = <Date 2015-02-13.19:23:25.772>
    user = 'https://github.com/Sidnicious'

    bugs.python.org fields:

    activity = <Date 2015-02-13.19:23:25.772>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2012-04-23.17:48:02.699>
    creator = 'ssm'
    dependencies = []
    files = ['25320', '25624', '38131']
    hgrepos = []
    issue_num = 14652
    keywords = ['patch']
    message_count = 4.0
    messages = ['159053', '160951', '160971', '235914']
    nosy_count = 3.0
    nosy_names = ['mcjeff', 'berker.peksag', 'ssm']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue14652'
    versions = ['Python 3.4', 'Python 3.5']

    @Sidnicious
    Copy link
    Mannequin Author

    Sidnicious mannequin commented Apr 23, 2012

    wsgiref’s validation middleware is missing messages for many of its assertions, and its docstring doesn’t reflect read() now requiring an argument (said that it took an optional argument).

    Here’s a patch to add some and update the comment.

    @Sidnicious Sidnicious mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Apr 23, 2012
    @mcjeff
    Copy link
    Mannequin

    mcjeff mannequin commented May 17, 2012

    I went through the patch real quick and I noticed that your using single element tuples in your string formatting. That makes sense in situations where the argument might itself be a tuple, however, not on calls to len() as that will return an integer.

    @Sidnicious
    Copy link
    Mannequin Author

    Sidnicious mannequin commented May 17, 2012

    Thanks Jeff, I’m actually a relatively new Python developer and got the impression that it was best practice to always use a tuple for string formatting, for consistency.

    Here’s an updated patch which drops the tuples for those cases.

    @berkerpeksag
    Copy link
    Member

    Here is an updated patch. For InputWrapper.read(), see bpo-18610.

    @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
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant