This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Filip.Malczak
Recipients Daniel.Andrade.Groppe, Filip.Malczak, orsenthil, r.david.murray
Date 2014-03-16.23:59:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395014340.64.0.796022057067.issue20898@psf.upfronthosting.co.za>
In-reply-to
Content
If we're getting out of original scope, then I wonder... Maybe we should keep only standard status codes here? If not, which should we support, and which not? What about custom Spring 420 Method Failure?

One way to clean up mess here is to create some dictionaries called Http09, Http10, Http11, but also Nginx, Spring, InternetDraft, etc - they would hold codes specific to some standard or extension (and they should be incremental, so Http11 would hold only those codes that came with HTTP 1.1, not any of HTTP 1.0 codes).

Also, we should provide function responses_mapping which should take dictionaries with code mappings, so one may use it like responses_mapping(Http09, Http10, Http11, Spring). Module attribute responses should be initialized to responses_mapping(Http09, Http10, Http11), so it would contain standard codes only.

responses_mapping (we should probably consider different name) should take any number of dicts, merge them and return merging result. Additionally, I think it should overwrite merged values, so if we call it with two dicts, which hold the same key - value from last dict with this key should be used. Essentially, it is just:
def responses_mapping(*dicts):
    out = {}
    for d in dicts:
        out.update(d)
    return out

Now, we would have clean responses dictionary (mentioned in first comment, one that started this issue), and possibility to extend responses set with different protocol and extension versions.

There may be one problem - many apps and libs (possibly standard python library too) may use keys from out of HTTP standard, so this change could break backwards compability.
History
Date User Action Args
2014-03-16 23:59:00Filip.Malczaksetrecipients: + Filip.Malczak, orsenthil, r.david.murray, Daniel.Andrade.Groppe
2014-03-16 23:59:00Filip.Malczaksetmessageid: <1395014340.64.0.796022057067.issue20898@psf.upfronthosting.co.za>
2014-03-16 23:59:00Filip.Malczaklinkissue20898 messages
2014-03-16 23:59:00Filip.Malczakcreate