diff options
| author | Chris McDonough <chrism@plope.com> | 2014-09-10 01:31:37 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2014-09-10 01:31:37 -0400 |
| commit | 7e9c54ed645db97049a0848eececad3437624163 (patch) | |
| tree | d1fa4bad6a63d239db0c98d6e95bd73ac5853f2d | |
| parent | 3587a53dc28b8f6411816ccd7fd8fdee0d88acb4 (diff) | |
| parent | befc1b81d7713d5dab130388c285e83d641f7190 (diff) | |
| download | pyramid-7e9c54ed645db97049a0848eececad3437624163.tar.gz pyramid-7e9c54ed645db97049a0848eececad3437624163.tar.bz2 pyramid-7e9c54ed645db97049a0848eececad3437624163.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
| -rw-r--r-- | .travis.yml | 1 | ||||
| -rw-r--r-- | HACKING.txt | 1 | ||||
| -rw-r--r-- | docs/narr/i18n.rst | 8 | ||||
| -rw-r--r-- | pyramid/renderers.py | 14 |
4 files changed, 14 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml index ce27b5ec3..4ca998c42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ python: - 3.2 - 3.3 - 3.4 + - pypy3 install: python setup.py dev diff --git a/HACKING.txt b/HACKING.txt index 1386be3af..e3afbf241 100644 --- a/HACKING.txt +++ b/HACKING.txt @@ -113,6 +113,7 @@ for this use case) and inside that a simple pyramid application named ``hacking`` that you can then fire up like so: cd env27/hacking + ../bin/python setup.py develop ../bin/pserve development.ini Adding Features 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. diff --git a/pyramid/renderers.py b/pyramid/renderers.py index 108255ee4..e647ebacf 100644 --- a/pyramid/renderers.py +++ b/pyramid/renderers.py @@ -248,7 +248,7 @@ class JSON(object): When you've done this, the JSON renderer will be able to serialize instances of the ``Foo`` class when they're encountered in your view results.""" - + self.components.registerAdapter(adapter, (type_or_iface,), IJSONAdapter) @@ -265,7 +265,7 @@ class JSON(object): response.content_type = 'application/json' default = self._make_default(request) return self.serializer(value, default=default, **self.kw) - + return _render def _make_default(self, request): @@ -286,7 +286,7 @@ json_renderer_factory = JSON() # bw compat class JSONP(JSON): """ `JSONP <http://en.wikipedia.org/wiki/JSONP>`_ renderer factory helper which implements a hybrid json/jsonp renderer. JSONP is useful for - making cross-domain AJAX requests. + making cross-domain AJAX requests. Configure a JSONP renderer using the :meth:`pyramid.config.Configurator.add_renderer` API at application @@ -309,7 +309,7 @@ class JSONP(JSON): config = Configurator() config.add_renderer('jsonp', JSONP(param_name='callback', indent=4)) - + .. versionchanged:: 1.4 The ability of this class to accept a ``**kw`` in its constructor. @@ -487,18 +487,18 @@ class NullRendererHelper(RendererHelper): @property def settings(self): - return get_current_registry().settings or {} + return {} def render_view(self, request, value, view, context): return value def render(self, value, system_values, request=None): return value - + def render_to_response(self, value, system_values, request=None): return value def clone(self, name=None, package=None, registry=None): return self - + null_renderer = NullRendererHelper() |
