diff options
| author | Tim Tisdall <tisdall@gmail.com> | 2014-08-14 10:31:22 -0400 |
|---|---|---|
| committer | Tim Tisdall <tisdall@gmail.com> | 2014-08-14 10:31:22 -0400 |
| commit | ddc745ff6497a5c08c44e2fc8f722ad0034948dc (patch) | |
| tree | 6e56433148c706d33e05e00bee0f470e23c6140c /docs/narr/i18n.rst | |
| parent | 3587a53dc28b8f6411816ccd7fd8fdee0d88acb4 (diff) | |
| download | pyramid-ddc745ff6497a5c08c44e2fc8f722ad0034948dc.tar.gz pyramid-ddc745ff6497a5c08c44e2fc8f722ad0034948dc.tar.bz2 pyramid-ddc745ff6497a5c08c44e2fc8f722ad0034948dc.zip | |
remove unnecessary use of `get_current_registry()`
- We have a request object, so get the current registry
properly through it.
- make use of the built-in `aslist` function for parsing the result
Diffstat (limited to 'docs/narr/i18n.rst')
| -rw-r--r-- | docs/narr/i18n.rst | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/narr/i18n.rst b/docs/narr/i18n.rst index 95f663584..3313f8dad 100644 --- a/docs/narr/i18n.rst +++ b/docs/narr/i18n.rst @@ -792,9 +792,11 @@ Then as a part of the code of a custom :term:`locale negotiator`: .. code-block:: python :linenos: - from pyramid.threadlocal import get_current_registry - settings = get_current_registry().settings - languages = settings['available_languages'].split() + from pyramid.settings import aslist + + def my_locale_negotiator(request): + languages = aslist(request.registry.settings['available_languages']) + # ... This is only a suggestion. You can create your own "available languages" configuration scheme as necessary. |
