diff options
| -rw-r--r-- | docs/api/request.rst | 4 | ||||
| -rw-r--r-- | docs/narr/environment.rst | 3 | ||||
| -rw-r--r-- | docs/narr/extending.rst | 2 | ||||
| -rw-r--r-- | docs/narr/sessions.rst | 2 | ||||
| -rw-r--r-- | docs/narr/urldispatch.rst | 9 | ||||
| -rw-r--r-- | pyramid/path.py | 42 | ||||
| -rw-r--r-- | pyramid/renderers.py | 37 | ||||
| -rw-r--r-- | pyramid/session.py | 12 | ||||
| -rw-r--r-- | pyramid/url.py | 5 | ||||
| -rw-r--r-- | pyramid/view.py | 27 |
10 files changed, 65 insertions, 78 deletions
diff --git a/docs/api/request.rst b/docs/api/request.rst index e4034c635..9f1f71b31 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -163,9 +163,7 @@ .. method:: invoke_subrequest(request, use_tweens=False) - .. warning:: - - This API was added in Pyramid 1.4a1. + .. versionadded:: 1.4a1 Obtain a response object from the Pyramid application based on information in the ``request`` object provided. The ``request`` object diff --git a/docs/narr/environment.rst b/docs/narr/environment.rst index 8206e0bcb..def5e12a4 100644 --- a/docs/narr/environment.rst +++ b/docs/narr/environment.rst @@ -504,12 +504,13 @@ default, this is ``false``. Mako Preprocessor ~~~~~~~~~~~~~~~~~ +.. versionadded:: 1.1 + A callable (or a :term:`dotted Python name` which names a callable) which is called to preprocess the source before the template is called. The callable will be passed the full template source before it is parsed. The return result of the callable will be used as the template source code. -.. note:: This feature is new in Pyramid 1.1. +-----------------------------+ | Config File Setting Name | diff --git a/docs/narr/extending.rst b/docs/narr/extending.rst index c464203f0..dd9281c73 100644 --- a/docs/narr/extending.rst +++ b/docs/narr/extending.rst @@ -84,7 +84,7 @@ function in your application's ``__init__.py``. For example, rather than: config.add_view('myapp.views.view1', name='view1') config.add_view('myapp.views.view2', name='view2') -You should do move the calls to ``add_view`` outside of the (non-reusable) +You should move the calls to ``add_view`` outside of the (non-reusable) ``if __name__ == '__main__'`` block, and into a reusable function: .. code-block:: python diff --git a/docs/narr/sessions.rst b/docs/narr/sessions.rst index f7da7838e..fa4affd8a 100644 --- a/docs/narr/sessions.rst +++ b/docs/narr/sessions.rst @@ -29,7 +29,7 @@ during your :app:`Pyramid` configuration. A very basic, insecure sample session factory implementation is provided in the :app:`Pyramid` core. It uses a cookie to store session information. This implementation has the following -limitation: +limitations: - The session information in the cookies used by this implementation is *not* encrypted, so it can be viewed by anyone with access to the diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index ec97bf3b2..749a2d49a 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -758,11 +758,8 @@ other non-``name`` and non-``pattern`` arguments to exception to this rule is use of the ``pregenerator`` argument, which is not ignored when ``static`` is ``True``. -.. note:: - - the ``static`` argument to - :meth:`~pyramid.config.Configurator.add_route` is new as of :app:`Pyramid` - 1.1. +.. versionadded:: 1.1 + the ``static`` argument to :meth:`~pyramid.config.Configurator.add_route` .. index:: single: redirecting to slash-appended routes @@ -906,7 +903,7 @@ routes configured in your application; for more information, see Using a Route Prefix to Compose Applications -------------------------------------------- -.. note:: This feature is new as of :app:`Pyramid` 1.2. +.. versionadded:: 1.2 The :meth:`pyramid.config.Configurator.include` method allows configuration statements to be included from separate files. See diff --git a/pyramid/path.py b/pyramid/path.py index e9c63a365..57eccdb19 100644 --- a/pyramid/path.py +++ b/pyramid/path.py @@ -114,7 +114,7 @@ class AssetResolver(Resolver): """ A class used to resolve an :term:`asset specification` to an :term:`asset descriptor`. - .. note:: This API is new as of Pyramid 1.3. + .. versionadded:: 1.3 The constructor accepts a single argument named ``package`` which may be any of: @@ -133,20 +133,19 @@ class AssetResolver(Resolver): to the :meth:`~pyramid.path.AssetResolver.resolve` method. An asset specification without a colon in it is treated as relative. - If the value ``None`` is supplied as the ``package``, the resolver will + If ``package`` is ``None``, the resolver will only be able to resolve fully qualified (not relative) asset specifications. Any attempt to resolve a relative asset specification - when the ``package`` is ``None`` will result in an :exc:`ValueError` - exception. + will result in an :exc:`ValueError` exception. - If the value :attr:`pyramid.path.CALLER_PACKAGE` is supplied as the - ``package``, the resolver will treat relative asset specifications as + If ``package`` is :attr:`pyramid.path.CALLER_PACKAGE`, + the resolver will treat relative asset specifications as relative to the caller of the :meth:`~pyramid.path.AssetResolver.resolve` method. - If a *module* or *module name* (as opposed to a package or package name) - is supplied as ``package``, its containing package is computed and this - package used to derive the package name (all names are resolved relative + If ``package`` is a *module* or *module name* (as opposed to a package or + package name), its containing package is computed and this + package is used to derive the package name (all names are resolved relative to packages, never to modules). For example, if the ``package`` argument to this type was passed the string ``xml.dom.expatbuilder``, and ``template.pt`` is supplied to the @@ -154,8 +153,8 @@ class AssetResolver(Resolver): asset spec would be ``xml.minidom:template.pt``, because ``xml.dom.expatbuilder`` is a module object, not a package object. - If a *package* or *package name* (as opposed to a module or module name) - is supplied as ``package``, this package will be used to compute relative + If ``package`` is a *package* or *package name* (as opposed to a module or + module name), this package will be used to compute relative asset specifications. For example, if the ``package`` argument to this type was passed the string ``xml.dom``, and ``template.pt`` is supplied to the :meth:`~pyramid.path.AssetResolver.resolve` method, the resulting @@ -209,7 +208,7 @@ class DottedNameResolver(Resolver): """ A class used to resolve a :term:`dotted Python name` to a package or module object. - .. note:: This API is new as of Pyramid 1.3. + .. versionadded:: 1.3 The constructor accepts a single argument named ``package`` which may be any of: @@ -229,18 +228,17 @@ class DottedNameResolver(Resolver): which has a ``.`` (dot) or ``:`` (colon) as its first character is treated as relative. - If the value ``None`` is supplied as the ``package``, the resolver will - only be able to resolve fully qualified (not relative) names. Any - attempt to resolve a relative name when the ``package`` is ``None`` will - result in an :exc:`ValueError` exception. + If ``package`` is ``None``, the resolver will only be able to resolve + fully qualified (not relative) names. Any attempt to resolve a + relative name will result in an :exc:`ValueError` exception. - If the value :attr:`pyramid.path.CALLER_PACKAGE` is supplied as the - ``package``, the resolver will treat relative dotted names as relative to + If ``package`` is :attr:`pyramid.path.CALLER_PACKAGE`, + the resolver will treat relative dotted names as relative to the caller of the :meth:`~pyramid.path.DottedNameResolver.resolve` method. - If a *module* or *module name* (as opposed to a package or package name) - is supplied as ``package``, its containing package is computed and this + If ``package`` is a *module* or *module name* (as opposed to a package or + package name), its containing package is computed and this package used to derive the package name (all names are resolved relative to packages, never to modules). For example, if the ``package`` argument to this type was passed the string ``xml.dom.expatbuilder``, and @@ -249,8 +247,8 @@ class DottedNameResolver(Resolver): import would be for ``xml.minidom``, because ``xml.dom.expatbuilder`` is a module object, not a package object. - If a *package* or *package name* (as opposed to a module or module name) - is supplied as ``package``, this package will be used to relative compute + If ``package`` is a *package* or *package name* (as opposed to a module or + module name), this package will be used to relative compute dotted names. For example, if the ``package`` argument to this type was passed the string ``xml.dom``, and ``.minidom`` is supplied to the :meth:`~pyramid.path.DottedNameResolver.resolve` method, the resulting diff --git a/pyramid/renderers.py b/pyramid/renderers.py index 6839d72f5..6310b7fee 100644 --- a/pyramid/renderers.py +++ b/pyramid/renderers.py @@ -43,23 +43,23 @@ from pyramid.threadlocal import get_current_registry # API def render(renderer_name, value, request=None, package=None): - """ Using the renderer specified as ``renderer_name`` (a template - or a static renderer) render the value (or set of values) present + """ Using the renderer ``renderer_name`` (a template + or a static renderer), render the value (or set of values) present in ``value``. Return the result of the renderer's ``__call__`` method (usually a string or Unicode). - If the renderer name refers to a file on disk (such as when the - renderer is a template), it's usually best to supply the name as a + If the ``renderer_name`` refers to a file on disk, such as when the + renderer is a template, it's usually best to supply the name as an :term:`asset specification` (e.g. ``packagename:path/to/template.pt``). You may supply a relative asset spec as ``renderer_name``. If the ``package`` argument is supplied, a relative renderer path will be converted to an absolute asset specification by - combining the package supplied as ``package`` with the relative - asset specification supplied as ``renderer_name``. If you do - not supply a ``package`` (or ``package`` is ``None``) the package - name of the *caller* of this function will be used as the package. + combining the package ``package`` with the relative + asset specification ``renderer_name``. If ``package`` + is ``None`` (the default), the package name of the *caller* of + this function will be used as the package. The ``value`` provided will be supplied as the input to the renderer. Usually, for template renderings, this should be a @@ -70,7 +70,7 @@ def render(renderer_name, value, request=None, package=None): top-level system names, such as ``request``, ``context``, ``renderer_name``, and ``view``. See :ref:`renderer_system_values` for the full list. If :term:`renderer globals` have been specified, these - will also be used to agument the value. + will also be used to augment the value. Supply a ``request`` parameter in order to provide the renderer with the most correct 'system' values (``request`` and ``context`` @@ -88,8 +88,8 @@ def render(renderer_name, value, request=None, package=None): return helper.render(value, None, request=request) def render_to_response(renderer_name, value, request=None, package=None): - """ Using the renderer specified as ``renderer_name`` (a template - or a static renderer) render the value (or set of values) using + """ Using the renderer ``renderer_name`` (a template + or a static renderer), render the value (or set of values) using the result of the renderer's ``__call__`` method (usually a string or Unicode) as the response body. @@ -100,8 +100,8 @@ def render_to_response(renderer_name, value, request=None, package=None): You may supply a relative asset spec as ``renderer_name``. If the ``package`` argument is supplied, a relative renderer name will be converted to an absolute asset specification by - combining the package supplied as ``package`` with the relative - asset specification supplied as ``renderer_name``. If you do + combining the package ``package`` with the relative + asset specification ``renderer_name``. If you do not supply a ``package`` (or ``package`` is ``None``) the package name of the *caller* of this function will be used as the package. @@ -134,16 +134,15 @@ def render_to_response(renderer_name, value, request=None, package=None): return helper.render_to_response(value, None, request=request) def get_renderer(renderer_name, package=None): - """ Return the renderer object for the renderer named as - ``renderer_name``. + """ Return the renderer object for the renderer ``renderer_name``. You may supply a relative asset spec as ``renderer_name``. If the ``package`` argument is supplied, a relative renderer name will be converted to an absolute asset specification by - combining the package supplied as ``package`` with the relative - asset specification supplied as ``renderer_name``. If you do - not supply a ``package`` (or ``package`` is ``None``) the package - name of the *caller* of this function will be used as the package. + combining the package ``package`` with the relative + asset specification ``renderer_name``. If ``package`` is ``None`` + (the default), the package name of the *caller* of this function + will be used as the package. """ if package is None: package = caller_package() diff --git a/pyramid/session.py b/pyramid/session.py index a5e6a8d3a..7db8c8e0e 100644 --- a/pyramid/session.py +++ b/pyramid/session.py @@ -140,30 +140,30 @@ def UnencryptedCookieSessionFactoryConfig( A number of seconds of inactivity before a session times out. ``cookie_name`` - The name of the cookie used for sessioning. Default: ``session``. + The name of the cookie used for sessioning. ``cookie_max_age`` The maximum age of the cookie used for sessioning (in seconds). Default: ``None`` (browser scope). ``cookie_path`` - The path used for the session cookie. Default: ``/``. + The path used for the session cookie. ``cookie_domain`` The domain used for the session cookie. Default: ``None`` (no domain). ``cookie_secure`` - The 'secure' flag of the session cookie. Default: ``False``. + The 'secure' flag of the session cookie. ``cookie_httponly`` - The 'httpOnly' flag of the session cookie. Default: ``False``. + The 'httpOnly' flag of the session cookie. ``cookie_on_exception`` If ``True``, set a session cookie even if an exception occurs - while rendering a view. Default: ``True``. + while rendering a view. ``signed_serialize`` - A callable which takes more or less arbitrary python data structure and + A callable which takes more or less arbitrary Python data structure and a secret and returns a signed serialization in bytes. Default: ``signed_serialize`` (using pickle). diff --git a/pyramid/url.py b/pyramid/url.py index 8fb5e49ab..84b58ac45 100644 --- a/pyramid/url.py +++ b/pyramid/url.py @@ -390,9 +390,8 @@ class URLMethodsMixin(object): pass ``app_url=''`. Passing ``app_url=''` when the resource path is ``/baz/bar`` will return ``/baz/bar``. - .. note:: - - ``app_url`` is new as of Pyramid 1.3. + .. versionadded:: 1.3 + ``app_url`` If ``app_url`` is passed and any of ``scheme``, ``port``, or ``host`` are also passed, ``app_url`` will take precedence and the values diff --git a/pyramid/view.py b/pyramid/view.py index 40d7c19b9..b88c2ea85 100644 --- a/pyramid/view.py +++ b/pyramid/view.py @@ -29,9 +29,11 @@ _marker = object() class static(static_view): """ Backwards compatibility alias for :class:`pyramid.static.static_view`; it overrides that class' constructor - to pass ``use_subpath=True`` by default. This class is deprecated as of - :app:`Pyramid` 1.1. Use :class:`pyramid.static.static_view` instead - (probably with a ``use_subpath=True`` argument). + to pass ``use_subpath=True`` by default. + + .. deprecated:: 1.1 + use :class:`pyramid.static.static_view` instead + (probably with a ``use_subpath=True`` argument) """ def __init__(self, root_dir, cache_max_age=3600, package_name=None): if package_name is None: @@ -312,11 +314,12 @@ See also :ref:`changing_the_notfound_view`. class notfound_view_config(object): """ + .. versionadded:: 1.3 An analogue of :class:`pyramid.view.view_config` which registers a - :term:`not found view`. + :term:`Not Found View`. - The notfound_view_config constructor accepts most of the same arguments + The ``notfound_view_config`` constructor accepts most of the same arguments as the constructor of :class:`pyramid.view.view_config`. It can be used in the same places, and behaves in largely the same way, except it always registers a not found exception view instead of a 'normal' view. @@ -346,9 +349,6 @@ class notfound_view_config(object): See :ref:`changing_the_notfound_view` for detailed usage information. - .. note:: - - This class is new as of Pyramid 1.3. """ venusian = venusian @@ -377,6 +377,7 @@ class notfound_view_config(object): class forbidden_view_config(object): """ + .. versionadded:: 1.3 An analogue of :class:`pyramid.view.view_config` which registers a :term:`forbidden view`. @@ -403,9 +404,6 @@ class forbidden_view_config(object): See :ref:`changing_the_forbidden_view` for detailed usage information. - .. note:: - - This class is new as of Pyramid 1.3. """ venusian = venusian @@ -436,11 +434,8 @@ def is_response(ob): """ Return ``True`` if ``ob`` implements the interface implied by :ref:`the_response`. ``False`` if not. - .. warning:: - - This function is deprecated as of :app:`Pyramid` 1.1. New - code should not use it. Instead, new code should use the - :func:`pyramid.request.Request.is_response` method.""" + .. deprecated:: 1.1 + use :func:`pyramid.request.Request.is_response` instead""" if ( hasattr(ob, 'app_iter') and hasattr(ob, 'headerlist') and hasattr(ob, 'status') ): return True |
