diff -Naur Django-1.3.orig/django/utils/translation/trans_real.py Django-1.3/django/utils/translation/trans_real.py
old
|
new
|
|
30 | 30 | |
31 | 31 | # Format of Accept-Language header values. From RFC 2616, section 14.4 and 3.9. |
32 | 32 | accept_language_re = re.compile(r''' |
33 | | ([A-Za-z]{1,8}(?:-[A-Za-z]{1,8})*|\*) # "en", "en-au", "x-y-z", "*" |
34 | | (?:;q=(0(?:\.\d{,3})?|1(?:.0{,3})?))? # Optional "q=1.00", "q=0.8" |
35 | | (?:\s*,\s*|$) # Multiple accepts per header. |
| 33 | ([A-Za-z]{1,8}(?:-[A-Za-z]{1,8})*|\*) # "en", "en-au", "x-y-z", "*" |
| 34 | (?:\s*;\s*q=(0(?:\.\d{,3})?|1(?:.0{,3})?))? # Optional "q=1.00", "q=0.8" |
| 35 | (?:\s*,\s*|$) # Multiple accepts per header. |
36 | 36 | ''', re.VERBOSE) |
37 | 37 | |
38 | 38 | def to_locale(language, to_lower=False): |
diff -Naur Django-1.3.orig/tests/regressiontests/i18n/tests.py Django-1.3/tests/regressiontests/i18n/tests.py
old
|
new
|
|
553 | 553 | self.assertEqual([('de', 1.0), ('en-au', 0.75), ('en-us', 0.5), ('en', 0.25), ('es', 0.125), ('fa', 0.125)], p('de,en-au;q=0.75,en-us;q=0.5,en;q=0.25,es;q=0.125,fa;q=0.125')) |
554 | 554 | self.assertEqual([('*', 1.0)], p('*')) |
555 | 555 | self.assertEqual([('de', 1.0)], p('de;q=0.')) |
| 556 | self.assertEqual([('en', 1.0), ('*', 0.5)], p('en; q=1.0, * ; q=0.5')) |
556 | 557 | self.assertEqual([], p('')) |
557 | 558 | |
558 | 559 | # Bad headers; should always return []. |