-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Allow Headers.add to get a list of parameters on *args #1100
Conversation
This ensures the order of parameters, which can be useful for issues like supporting IE8 in flask's pallets#2223
e10a37e
to
cdfacb4
Compare
werkzeug/datastructures.py
Outdated
@@ -1140,7 +1140,7 @@ def __iter__(self): | |||
def __len__(self): | |||
return len(self._list) | |||
|
|||
def add(self, _key, _value, **kw): | |||
def add(self, _key, _value, *args, **kw): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
werkzeug/datastructures.py
Outdated
@@ -1153,9 +1153,15 @@ def add(self, _key, _value, **kw): | |||
The keyword argument dumping uses :func:`dump_options_header` | |||
behind the scenes. | |||
|
|||
In some cases, it would be needed to ensure the order of parameters. | |||
For those cases, a list of ``(key, value)`` tuples can be passed in | |||
*args. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
werkzeug/datastructures.py
Outdated
@@ -1153,9 +1153,15 @@ def add(self, _key, _value, **kw): | |||
The keyword argument dumping uses :func:`dump_options_header` | |||
behind the scenes. | |||
|
|||
In some cases, it would be needed to ensure the order of parameters. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
werkzeug/http.py
Outdated
if isinstance(options, tuple): | ||
iter_func = iter | ||
else: | ||
iter_func = iteritems |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
werkzeug/datastructures.py
Outdated
.. versionadded:: 0.4.1 | ||
keyword arguments were added for :mod:`wsgiref` compatibility. | ||
""" | ||
if args: | ||
_value = dump_options_header(_value, args) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
pass args to _options_header_vkw allow positional args to set too more permissive mapping vs sequence check
50747b9
to
2ed8556
Compare
From pallets/flask#2223:
I don't think we should go down this route since by the standard there is no reason this should be necessary. Also we're talking about IE8 here. If the user cares about that browser they can ensure they pass an ASCII filename to |
I guess the order shouldn't matter for the options, but it still seemed like a relatively minor addition. Who knows if there's other weird browser behavior that still cares about the order? I wasn't planning to apply this to Flask since that would require pinning the version. |
I wouldn't add those things on a preemptive basis.
…On Sat, Apr 08, 2017 at 09:51:05AM -0700, David Lord wrote:
I guess the order shouldn't matter for the options, but it still seemed like a relatively minor addition. Who knows if there's other weird browser behavior that still cares about the order? I wasn't going to use this in Flask since that would require pinning the version.
--
You are receiving this because your review was requested.
Reply to this email directly or view it on GitHub:
#1100 (comment)
|
Fair enough. Thanks for making this PR @antlarr. We'll close it for now, but if it comes up in a modern situation later we can merge it then. |
This ensures the order of parameters, which can be useful for issues like supporting IE8 in pallets/flask#2223.