summaryrefslogtreecommitdiff
path: root/docs/api
diff options
context:
space:
mode:
Diffstat (limited to 'docs/api')
-rw-r--r--docs/api/compat.rst156
-rw-r--r--docs/api/config.rst17
-rw-r--r--docs/api/interfaces.rst8
-rw-r--r--docs/api/paster.rst11
-rw-r--r--docs/api/path.rst20
-rw-r--r--docs/api/registry.rst31
-rw-r--r--docs/api/settings.rst2
-rw-r--r--docs/api/view.rst3
8 files changed, 241 insertions, 7 deletions
diff --git a/docs/api/compat.rst b/docs/api/compat.rst
new file mode 100644
index 000000000..bb34f38e4
--- /dev/null
+++ b/docs/api/compat.rst
@@ -0,0 +1,156 @@
+.. _compat_module:
+
+:mod:`pyramid.compat`
+----------------------
+
+The ``pyramid.compat`` module provides platform and version compatibility for
+Pyramid and its add-ons across Python platform and version differences. APIs
+will be removed from this module over time as Pyramid ceases to support
+systems which require compatibility imports.
+
+.. automodule:: pyramid.compat
+
+ .. autofunction:: ascii_native_
+
+ .. attribute:: binary_type
+
+ Binary type for this platform. For Python 3, it's ``bytes``. For
+ Python 2, it's ``str``.
+
+ .. autofunction:: bytes_
+
+ .. attribute:: class_types
+
+ Sequence of class types for this platform. For Python 3, it's
+ ``(type,)``. For Python 2, it's ``(type, types.ClassType)``.
+
+ .. attribute:: configparser
+
+ On Python 2, the ``ConfigParser`` module, on Python 3, the
+ ``configparser`` module.
+
+ .. function:: escape(v)
+
+ On Python 2, the ``cgi.escape`` function, on Python 3, the
+ ``html.escape`` function.
+
+ .. function:: exec_(code, globs=None, locs=None)
+
+ Exec code in a compatible way on both Python 2 and 3.
+
+ .. attribute:: im_func
+
+ On Python 2, the string value ``im_func``, on Python 3, the string
+ value ``__func__``.
+
+ .. function:: input_(v)
+
+ On Python 2, the ``raw_input`` function, on Python 3, the
+ ``input`` function.
+
+ .. attribute:: integer_types
+
+ Sequence of integer types for this platform. For Python 3, it's
+ ``(int,)``. For Python 2, it's ``(int, long)``.
+
+ .. function:: is_nonstr_iter(v)
+
+ Return ``True`` if ``v`` is a non-``str`` iterable on both Python 2 and
+ Python 3.
+
+ .. function:: iteritems_(d)
+
+ Return ``d.items()`` on Python 3, ``d.iteritems()`` on Python 2.
+
+ .. function:: itervalues_(d)
+
+ Return ``d.values()`` on Python 3, ``d.itervalues()`` on Python 2.
+
+ .. function:: iterkeys_(d)
+
+ Return ``d.keys()`` on Python 3, ``d.iterkeys()`` on Python 2.
+
+ .. attribute:: long
+
+ Long type for this platform. For Python 3, it's ``int``. For
+ Python 2, it's ``long``.
+
+ .. function:: map_(v)
+
+ Return ``list(map(v))`` on Python 3, ``map(v)`` on Python 2.
+
+ .. attribute:: pickle
+
+ ``cPickle`` module if it exists, ``pickle`` module otherwise.
+
+ .. attribute:: PY3
+
+ ``True`` if running on Python 3, ``False`` otherwise.
+
+ .. attribute:: PYPY
+
+ ``True`` if running on PyPy, ``False`` otherwise.
+
+ .. function:: reraise(tp, value, tb=None)
+
+ Reraise an exception in a compatible way on both Python 2 and Python 3,
+ e.g. ``reraise(*sys.exc_info())``.
+
+ .. attribute:: string_types
+
+ Sequence of string types for this platform. For Python 3, it's
+ ``(str,)``. For Python 2, it's ``(basestring,)``.
+
+ .. attribute:: SimpleCookie
+
+ On Python 2, the ``Cookie.SimpleCookie`` class, on Python 3, the
+ ``http.cookies.SimpleCookie`` module.
+
+ .. autofunction:: text_
+
+ .. attribute:: text_type
+
+ Text type for this platform. For Python 3, it's ``str``. For Python
+ 2, it's ``unicode``.
+
+ .. autofunction:: native_
+
+ .. attribute:: urlparse
+
+ ``urlparse`` module on Python 2, ``urllib.parse`` module on Python 3.
+
+ .. attribute:: url_quote
+
+ ``urllib.quote`` function on Python 2, ``urllib.parse.quote`` function
+ on Python 3.
+
+ .. attribute:: url_quote_plus
+
+ ``urllib.quote_plus`` function on Python 2, ``urllib.parse.quote_plus``
+ function on Python 3.
+
+ .. attribute:: url_unquote
+
+ ``urllib.unquote`` function on Python 2, ``urllib.parse.unquote``
+ function on Python 3.
+
+ .. attribute:: url_encode
+
+ ``urllib.urlencode`` function on Python 2, ``urllib.parse.urlencode``
+ function on Python 3.
+
+ .. attribute:: url_open
+
+ ``urllib2.urlopen`` function on Python 2, ``urllib.request.urlopen``
+ function on Python 3.
+
+ .. function:: url_unquote_text(v, encoding='utf-8', errors='replace')
+
+ On Python 2, return ``url_unquote(v).decode(encoding(encoding, errors))``;
+ on Python 3, return the result of ``urllib.parse.unquote``.
+
+ .. function:: url_unquote_native(v, encoding='utf-8', errors='replace')
+
+ On Python 2, return ``native_(url_unquote_text_v, encoding, errors))``;
+ on Python 3, return the result of ``urllib.parse.unquote``.
+
diff --git a/docs/api/config.rst b/docs/api/config.rst
index a8c193b60..dbfbb1761 100644
--- a/docs/api/config.rst
+++ b/docs/api/config.rst
@@ -94,6 +94,23 @@
.. automethod:: set_renderer_globals_factory(factory)
+ .. attribute:: introspectable
+
+ A shortcut attribute which points to the
+ :class:`pyramid.registry.Introspectable` class (used during
+ directives to provide introspection to actions).
+
+ This attribute is new as of :app:`Pyramid` 1.3.
+
+ .. attribute:: introspector
+
+ The :term:`introspector` related to this configuration. It is an
+ instance implementing the :class:`pyramid.interfaces.IIntrospector`
+ interface. If the Configurator constructor was supplied with an
+ ``introspector`` argument, this attribute will be that value.
+ Otherwise, it will be an instance of a default introspector type.
+
+ This attribute is new as of :app:`Pyramid` 1.3.
.. attribute:: global_registries
diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst
index b336e549d..5b190b53b 100644
--- a/docs/api/interfaces.rst
+++ b/docs/api/interfaces.rst
@@ -68,3 +68,11 @@ Other Interfaces
.. autointerface:: IResponse
:members:
+ .. autointerface:: IIntrospectable
+ :members:
+
+ .. autointerface:: IIntrospector
+ :members:
+
+ .. autointerface:: IActionInfo
+ :members:
diff --git a/docs/api/paster.rst b/docs/api/paster.rst
index 2a32e07e9..3f7a1c364 100644
--- a/docs/api/paster.rst
+++ b/docs/api/paster.rst
@@ -5,13 +5,10 @@
.. automodule:: pyramid.paster
- .. function:: get_app(config_uri, name=None)
+ .. autofunction:: bootstrap
- Return the WSGI application named ``name`` in the PasteDeploy
- config file specified by ``config_uri``.
+ .. autofunction:: get_app(config_uri, name=None)
- If the ``name`` is None, this will attempt to parse the name from
- the ``config_uri`` string expecting the format ``inifile#name``.
- If no name is found, the name will default to "main".
+ .. autofunction:: get_appsettings(config_uri, name=None)
- .. autofunction:: bootstrap
+ .. autofunction:: setup_logging(config_uri)
diff --git a/docs/api/path.rst b/docs/api/path.rst
new file mode 100644
index 000000000..d46c35d8e
--- /dev/null
+++ b/docs/api/path.rst
@@ -0,0 +1,20 @@
+.. _path_module:
+
+:mod:`pyramid.path`
+---------------------------
+
+.. automodule:: pyramid.path
+
+ .. attribute:: CALLER_PACKAGE
+
+ A constant used by the constructor of
+ :class:`pyramid.path.DottedNameResolver` and
+ :class:`pyramid.path.AssetResolver` (see their docstrings for more
+ info).
+
+ .. autoclass:: DottedNameResolver
+ :members:
+
+ .. autoclass:: AssetResolver
+ :members:
+
diff --git a/docs/api/registry.rst b/docs/api/registry.rst
index 4d327370a..e18d1b6c2 100644
--- a/docs/api/registry.rst
+++ b/docs/api/registry.rst
@@ -14,3 +14,34 @@
accessed as ``request.registry.settings`` or
``config.registry.settings`` in a typical Pyramid application.
+ .. attribute:: introspector
+
+ When a registry is set up (or created) by a :term:`Configurator`, the
+ registry will be decorated with an instance named ``introspector``
+ implementing the :class:`pyramid.interfaces.IIntrospector` interface.
+ See also :attr:`pyramid.config.Configurator.introspector``.
+
+ When a registry is created "by hand", however, this attribute will not
+ exist until set up by a configurator.
+
+ This attribute is often accessed as ``request.registry.introspector`` in
+ a typical Pyramid application.
+
+ This attribute is new as of :app:`Pyramid` 1.3.
+
+.. class:: Introspectable
+
+ The default implementation of the interface
+ :class:`pyramid.interfaces.IIntrospectable` used by framework exenders.
+ An instance of this class is is created when
+ :attr:`pyramid.config.Configurator.introspectable` is called.
+
+ This class is new as of :app:`Pyramid` 1.3.
+
+.. class:: noop_introspector
+
+ An introspector which throws away all registrations, useful for disabling
+ introspection altogether (pass as ``introspector`` to the
+ :term:`Configurator` constructor).
+
+ This class is new as of :app:`Pyramid` 1.3.
diff --git a/docs/api/settings.rst b/docs/api/settings.rst
index ac1cd3f9c..6b12c038c 100644
--- a/docs/api/settings.rst
+++ b/docs/api/settings.rst
@@ -9,4 +9,6 @@
.. autofunction:: asbool
+ .. autofunction:: aslist
+
diff --git a/docs/api/view.rst b/docs/api/view.rst
index 4dddea25f..9f59ddae7 100644
--- a/docs/api/view.rst
+++ b/docs/api/view.rst
@@ -16,6 +16,9 @@
.. autoclass:: view_config
:members:
+ .. autoclass:: view_defaults
+ :members:
+
.. autoclass:: static
:members:
:inherited-members: