Exemplo n.º 1
0
    def from_settings(cls, settings):
        """Create a new instance based on the `settings` dict.

        The locales supported by the application are read from the
        "locales" key. The format of the value is the same as that of
        the Accept-Language header, i.e.:

          <locale1>;q=<q1>,<locale2>;q=<q2>,...

        The q-values indicate the quality of the locale, but are
        optional.
        """
        locales = list(Accept.parse(settings.get("locales", "")))
        return cls(locales)
Exemplo n.º 2
0
def test_parse_accept_badq():
    assert list(Accept.parse("value1; q=0.1.2")) == [('value1', 1)]
Exemplo n.º 3
0
def test_parse_accept_badq():
    assert list(Accept.parse("value1; q=0.1.2")) == [('value1', 1)]