Commit ec0fb69
committed
accept_language parse; fix priority order; preserve insertion order
There are conditions under which the order is not correctly returned.
Use hashq.hashpop in a loop to get items out of hash (list) in proper
priority order. Make 3 element tuples in hashq include insertion
order. This makes tuples inserted later lower in priority when
priority q values are the same. Makes:
"zn;q=1.0;q= 1.0,pt-br,en-US; q=0.5"
return ['zn', 'pt_br', 'en_US'] (pt_br is default prio of 1 like
zn). Otherwise we get ['pt_br', 'zn', 'en_US'] since 'p' > 'z'.1 parent ec27f48 commit ec0fb69
2 files changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
67 | 68 | | |
| 69 | + | |
68 | 70 | | |
69 | | - | |
| 71 | + | |
70 | 72 | | |
71 | | - | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
75 | | - | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
13 | 23 | | |
14 | 24 | | |
15 | 25 | | |
| |||
0 commit comments