michr
2011-09-24 012b9762cd0b114b6afbf2d6356554b51706804a
fixed up all the warning dealing ..note and ..warn
added a hide toc for glossary to prevent warnings
31 files modified
605 ■■■■■ changed files
docs/designdefense.rst 4 ●●● patch | view | raw | blame | history
docs/index.rst 9 ●●●●● patch | view | raw | blame | history
docs/narr/assets.rst 8 ●●●● patch | view | raw | blame | history
docs/narr/hooks.rst 16 ●●●● patch | view | raw | blame | history
docs/narr/i18n.rst 8 ●●●● patch | view | raw | blame | history
docs/narr/install.rst 4 ●●● patch | view | raw | blame | history
docs/narr/logging.rst 4 ●●● patch | view | raw | blame | history
docs/narr/muchadoabouttraversal.rst 4 ●●● patch | view | raw | blame | history
docs/narr/project.rst 4 ●●● patch | view | raw | blame | history
docs/narr/resources.rst 4 ●●● patch | view | raw | blame | history
docs/narr/templates.rst 4 ●●● patch | view | raw | blame | history
docs/narr/urldispatch.rst 12 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki/definingviews.rst 8 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/definingviews.rst 4 ●●● patch | view | raw | blame | history
pyramid/config/__init__.py 19 ●●●● patch | view | raw | blame | history
pyramid/config/factories.py 20 ●●●●● patch | view | raw | blame | history
pyramid/config/i18n.py 8 ●●●●● patch | view | raw | blame | history
pyramid/config/rendering.py 10 ●●●● patch | view | raw | blame | history
pyramid/config/routes.py 20 ●●●●● patch | view | raw | blame | history
pyramid/config/security.py 28 ●●●●● patch | view | raw | blame | history
pyramid/config/util.py 2 ●●● patch | view | raw | blame | history
pyramid/config/views.py 48 ●●●● patch | view | raw | blame | history
pyramid/events.py 29 ●●●● patch | view | raw | blame | history
pyramid/interfaces.py 34 ●●●●● patch | view | raw | blame | history
pyramid/paster.py 34 ●●●● patch | view | raw | blame | history
pyramid/request.py 4 ●●●● patch | view | raw | blame | history
pyramid/security.py 8 ●●●●● patch | view | raw | blame | history
pyramid/static.py 18 ●●●●● patch | view | raw | blame | history
pyramid/traversal.py 104 ●●●● patch | view | raw | blame | history
pyramid/url.py 120 ●●●●● patch | view | raw | blame | history
pyramid/view.py 6 ●●●●● patch | view | raw | blame | history
docs/designdefense.rst
@@ -245,7 +245,9 @@
abandoned and it is not used in :app:`Pyramid`.  We continued to use a ZCA
registry within :app:`Pyramid` because it ultimately proved a better fit.
.. note:: We continued using ZCA registry rather than disusing it in
.. note::
   We continued using ZCA registry rather than disusing it in
   favor of using the registry implementation in
   :mod:`repoze.component` largely because the ZCA concept of
   interfaces provides for use of an interface hierarchy, which is
docs/index.rst
@@ -227,3 +227,12 @@
* :ref:`glossary`
* :ref:`genindex`
* :ref:`search`
.. add glossary in hidden toc tree so it does not complain its not included
.. toctree::
   :hidden:
   glossary
docs/narr/assets.rst
@@ -102,7 +102,9 @@
mechanism makes a directory of static files available at a name relative to
the application root URL, e.g. ``/static`` or as an external URL.
.. note:: :meth:`~pyramid.config.Configurator.add_static_view` cannot serve a
.. note::
   :meth:`~pyramid.config.Configurator.add_static_view` cannot serve a
   single file, nor can it serve a directory of static files directly
   relative to the root URL of a :app:`Pyramid` application.  For these
   features, see :ref:`advanced_static`.
@@ -312,7 +314,9 @@
:meth:`~pyramid.config.Configurator.add_static_view` configuration method, so
its behavior is almost exactly the same once it's configured.
.. warning:: The following example *will not work* for applications that use
.. warning::
   The following example *will not work* for applications that use
   :term:`traversal`, it will only work if you use :term:`URL dispatch`
   exclusively.  The root-relative route we'll be registering will always be
   matched before traversal takes place, subverting any views registered via
docs/narr/hooks.rst
@@ -55,7 +55,9 @@
   def notfound_view(request):
       return HTTPNotFound()
.. note:: When a NotFound view callable is invoked, it is passed a
.. note::
   When a NotFound view callable is invoked, it is passed a
   :term:`request`.  The ``exception`` attribute of the request will be an
   instance of the :exc:`~pyramid.httpexceptions.HTTPNotFound` exception that
   caused the not found view to be called.  The value of
@@ -64,7 +66,9 @@
   ``pyramid.debug_notfound`` environment setting is true than it is when it
   is false.
.. warning:: When a NotFound view callable accepts an argument list as
.. warning::
   When a NotFound view callable accepts an argument list as
   described in :ref:`request_and_context_view_definitions`, the ``context``
   passed as the first argument to the view callable will be the
   :exc:`~pyramid.httpexceptions.HTTPNotFound` exception instance.  If
@@ -121,7 +125,9 @@
   def forbidden_view(request):
       return Response('forbidden')
.. note:: When a forbidden view callable is invoked, it is passed a
.. note::
   When a forbidden view callable is invoked, it is passed a
   :term:`request`.  The ``exception`` attribute of the request will be an
   instance of the :exc:`~pyramid.httpexceptions.HTTPForbidden` exception
   that caused the forbidden view to be called.  The value of
@@ -1100,7 +1106,9 @@
declared directly "below" it, ad infinitum.  The "main" Pyramid request
handler is implicit, and always "at the bottom".
.. note:: Pyramid's own :term:`exception view` handling logic is implemented
.. note::
   Pyramid's own :term:`exception view` handling logic is implemented
   as a tween factory function: :func:`pyramid.tweens.excview_tween_factory`.
   If Pyramid exception view handling is desired, and tween factories are
   specified via the ``pyramid.tweens`` configuration setting, the
docs/narr/i18n.rst
@@ -518,7 +518,9 @@
   def aview(request):
       locale = get_localizer(request)
.. note:: If you need to create a localizer for a locale use the
.. note::
    If you need to create a localizer for a locale use the
    :func:`pyramid.i18n.make_localizer` function.
.. index::
@@ -555,7 +557,9 @@
``domain`` attribute of the provided translation string as well as the
locale of the localizer.
.. note:: If you're using :term:`Chameleon` templates, you don't need
.. note::
   If you're using :term:`Chameleon` templates, you don't need
   to pre-translate translation strings this way.  See
   :ref:`chameleon_translation_strings`.
docs/narr/install.rst
@@ -229,7 +229,9 @@
   New python executable in env/bin/python
   Installing setuptools.............done.
.. warning:: Using ``--no-site-packages`` when generating your
.. warning::
   Using ``--no-site-packages`` when generating your
   virtualenv is *very important*. This flag provides the necessary
   isolation for running the set of packages required by
   :app:`Pyramid`.  If you do not specify ``--no-site-packages``,
docs/narr/logging.rst
@@ -7,7 +7,9 @@
:mod:`logging` module.  This chapter describes how to configure logging and
how to send log messages to loggers that you've configured.
.. warning:: This chapter assumes you've used a :term:`scaffold` to create a
.. warning::
   This chapter assumes you've used a :term:`scaffold` to create a
   project which contains ``development.ini`` and ``production.ini`` files
   which help configure logging.  All of the scaffolds which ship along with
   :app:`Pyramid` do this.  If you're not using a scaffold, or if you've used
docs/narr/muchadoabouttraversal.rst
@@ -313,6 +313,8 @@
using :app:`Pyramid` and you ever find that you *do* need to support one of
these use cases, you'll be glad you have traversal in your toolkit.
.. note:: It is even possible to mix and match :term:`traversal` with
.. note::
   It is even possible to mix and match :term:`traversal` with
   :term:`URL dispatch` in the same :app:`Pyramid` application. See the
   :ref:`hybrid_chapter` chapter for details.
docs/narr/project.rst
@@ -64,7 +64,9 @@
  URL mapping via :term:`traversal` and persistence via
  :term:`SQLAlchemy`
.. note:: At this time, each of these scaffolds uses the :term:`Chameleon`
.. note::
   At this time, each of these scaffolds uses the :term:`Chameleon`
   templating system, which is incompatible with Jython.  To use scaffolds to
   build applications which will run on Jython, you can try the
   ``pyramid_jinja2_starter`` scaffold which ships as part of the
docs/narr/resources.rst
@@ -160,7 +160,9 @@
just like if you keep executing the ``cd ..`` filesystem command, eventually
you will reach the filesystem root directory.
.. warning:: If your root resource has a ``__name__`` argument that is not
.. warning::
   If your root resource has a ``__name__`` argument that is not
   ``None`` or the empty string, URLs returned by the
   :func:`~pyramid.request.Request.resource_url` function and paths generated
   by the :func:`~pyramid.traversal.resource_path` and
docs/narr/templates.rst
@@ -46,7 +46,9 @@
                                 {'foo':1, 'bar':2}, 
                                 request=request)
.. warning:: Earlier iterations of this documentation
.. warning::
   Earlier iterations of this documentation
   (pre-version-1.3) encouraged the application developer to use
   ZPT-specific APIs such as
   :func:`pyramid.chameleon_zpt.render_template_to_response` and
docs/narr/urldispatch.rst
@@ -353,7 +353,9 @@
Other arguments are ``name`` and ``factory``.  These arguments represent
neither predicates nor view configuration information.
.. warning:: Some arguments are view-configuration related arguments, such as
.. warning::
   Some arguments are view-configuration related arguments, such as
   ``view_renderer``.  These only have an effect when the route configuration
   names a ``view`` and these arguments have been deprecated as of
   :app:`Pyramid` 1.1.
@@ -646,7 +648,9 @@
exception to this rule is use of the ``pregenerator`` argument, which is not
ignored when ``static`` is ``True``.
.. note:: the ``static`` argument to
.. note::
   the ``static`` argument to
   :meth:`~pyramid.config.Configurator.add_route` is new as of :app:`Pyramid`
   1.1.
@@ -1098,7 +1102,9 @@
match dict to see if the ``article`` argument matches a particular string;
our sample ``Article`` factory class is not very ambitious.
.. note:: See :ref:`security_chapter` for more information about
.. note::
   See :ref:`security_chapter` for more information about
   :app:`Pyramid` security and ACLs.
.. index::
docs/tutorials/wiki/definingviews.rst
@@ -7,7 +7,9 @@
parameters: :term:`context` and :term:`request`.  A view callable is
assumed to return a :term:`response` object.
.. note:: A :app:`Pyramid` view can also be defined as callable
.. note::
   A :app:`Pyramid` view can also be defined as callable
   which accepts *only* a :term:`request` argument.  You'll see
   this one-argument pattern used in other :app:`Pyramid` tutorials
   and applications.  Either calling convention will work in any
@@ -253,7 +255,9 @@
.. literalinclude:: src/views/tutorial/templates/view.pt
   :language: xml
.. note:: The names available for our use in a template are always those that
.. note::
   The names available for our use in a template are always those that
   are present in the dictionary returned by the view callable.  But our
   templates make use of a ``request`` object that none of our tutorial views
   return in their dictionary.  This value appears as if "by magic".
docs/tutorials/wiki2/definingviews.rst
@@ -7,7 +7,9 @@
parameter named :term:`request`.  A view callable is assumed to return a
:term:`response` object.
.. note:: A :app:`Pyramid` view can also be defined as callable
.. note::
   A :app:`Pyramid` view can also be defined as callable
   which accepts *two* arguments: a :term:`context` and a
   :term:`request`.  You'll see this two-argument pattern used in
   other :app:`Pyramid` tutorials and applications.  Either calling
pyramid/config/__init__.py
@@ -140,9 +140,10 @@
    same.  See :ref:`adding_renderer_globals`.  By default, it is ``None``,
    which means use no renderer globals factory.
    .. warning:: as of Pyramid 1.1, ``renderer_globals_factory`` is
       deprecated.  Instead, use a BeforeRender event subscriber as per
       :ref:`beforerender_event`.
    .. warning::
       as of Pyramid 1.1, ``renderer_globals_factory`` is deprecated.  Instead,
       use a BeforeRender event subscriber as per :ref:`beforerender_event`.
    If ``default_permission`` is passed, it should be a
    :term:`permission` string to be used as the default permission for
@@ -288,7 +289,7 @@
        if debug_logger is None:
            debug_logger = logging.getLogger(self.package_name)
        registry.registerUtility(debug_logger, IDebugLogger)
        for name, renderer in DEFAULT_RENDERERS:
@@ -361,7 +362,7 @@
        tweens   = aslist(registry.settings.get('pyramid.tweens', []))
        for factory in tweens:
            self._add_tween(factory, explicit=True)
        includes = aslist(registry.settings.get('pyramid.includes', []))
        for inc in includes:
            self.include(inc)
@@ -557,7 +558,7 @@
        ``route_prefix``. This can be used to help mount a set of routes at a
        different location than the included callable's author intended while
        still maintaining the same route names.  For example:
        .. code-block:: python
           :linenos:
@@ -565,7 +566,7 @@
           def included(config):
               config.add_route('show_users', '/show')
           def main(global_config, **settings):
               config = Configurator()
               config.include(included, route_prefix='/users')
@@ -613,7 +614,7 @@
            configurator.basepath = os.path.dirname(sourcefile)
            configurator.includepath = self.includepath + (spec,)
            c(configurator)
    def add_directive(self, name, directive, action_wrap=True):
        """
        Add a directive method to the configurator.
@@ -636,7 +637,7 @@
        discriminators.  ``action_wrap`` will cause the directive to be
        wrapped in a decorator which provides more accurate conflict
        cause information.
        ``add_directive`` does not participate in conflict detection, and
        later calls to ``add_directive`` will override earlier calls.
        """
pyramid/config/factories.py
@@ -14,9 +14,11 @@
        state.  If the ``factory`` argument is ``None`` a default root
        factory will be registered.
        .. note:: Using the ``root_factory`` argument to the
           :class:`pyramid.config.Configurator` constructor
           can be used to achieve the same purpose.
        .. note::
           Using the ``root_factory`` argument to the
           :class:`pyramid.config.Configurator` constructor can be used to
           achieve the same purpose.
        """
        factory = self.maybe_dotted(factory)
        if factory is None:
@@ -35,9 +37,11 @@
        method is called, the ``session_factory`` argument must be a session
        factory callable or a :term:`dotted Python name` to that factory.
        .. note:: Using the ``session_factory`` argument to the
           :class:`pyramid.config.Configurator` constructor
           can be used to achieve the same purpose.
        .. note::
           Using the ``session_factory`` argument to the
           :class:`pyramid.config.Configurator` constructor can be used to
           achieve the same purpose.
        """
        session_factory = self.maybe_dotted(session_factory)
        def register():
@@ -54,7 +58,9 @@
        :class:`pyramid.request.Request` class (particularly
        ``__call__``, and ``blank``).
        .. note:: Using the ``request_factory`` argument to the
        .. note::
           Using the ``request_factory`` argument to the
           :class:`pyramid.config.Configurator` constructor
           can be used to achieve the same purpose.
        """
pyramid/config/i18n.py
@@ -30,9 +30,11 @@
        application.  See :ref:`activating_translation` for more
        information.
        .. note:: Using the ``locale_negotiator`` argument to the
           :class:`pyramid.config.Configurator` constructor
           can be used to achieve the same purpose.
        .. note::
           Using the ``locale_negotiator`` argument to the
           :class:`pyramid.config.Configurator` constructor can be used to
           achieve the same purpose.
        """
        def register():
            self._set_locale_negotiator(negotiator)
pyramid/config/rendering.py
@@ -39,7 +39,7 @@
        # if name is None or the empty string, we're trying to register
        # a default renderer, but registerUtility is too dumb to accept None
        # as a name
        if not name:
        if not name:
            name = ''
        def register():
            self.registry.registerUtility(factory, IRendererFactory, name=name)
@@ -61,9 +61,13 @@
        dictionary, and therefore will be made available to the code
        which uses the renderer.
        .. warning:: This method is deprecated as of Pyramid 1.1.
        .. warning::
        .. note:: Using the ``renderer_globals_factory`` argument
           This method is deprecated as of Pyramid 1.1.
        .. note::
           Using the ``renderer_globals_factory`` argument
           to the :class:`pyramid.config.Configurator` constructor
           can be used to achieve the same purpose.
        """
pyramid/config/routes.py
@@ -147,12 +147,14 @@
          pattern doesn't match the current URL, route matching
          continues.
          .. note:: For backwards compatibility purposes (as of
             :app:`Pyramid` 1.0), a ``path`` keyword argument passed
             to this function will be used to represent the pattern
             value if the ``pattern`` argument is ``None``.  If both
             ``path`` and ``pattern`` are passed, ``pattern`` wins.
          .. note::
             For backwards compatibility purposes (as of :app:`Pyramid` 1.0), a
             ``path`` keyword argument passed to this function will be used to
             represent the pattern value if the ``pattern`` argument is
             ``None``.  If both ``path`` and ``pattern`` are passed, ``pattern``
             wins.
        xhr
          This value should be either ``True`` or ``False``.  If this
@@ -249,7 +251,9 @@
        View-Related Arguments
        .. warning:: The arguments described below have been deprecated as of
        .. warning::
           The arguments described below have been deprecated as of
           :app:`Pyramid` 1.1. *Do not use these for new development; they
           should only be used to support older code bases which depend upon
           them.* Use a separate call to
@@ -267,7 +271,7 @@
        view_context
          .. warning:: Deprecated as of :app:`Pyramid` 1.1.
          A class or an :term:`interface` or :term:`dotted Python
          name` to the same object which the :term:`context` of the
          view should match for the view named by the route to be
pyramid/config/security.py
@@ -15,10 +15,12 @@
        of an authentication policy or a :term:`dotted Python name`
        that points at an instance of an authentication policy.
        .. note:: Using the ``authentication_policy`` argument to the
           :class:`pyramid.config.Configurator` constructor
           can be used to achieve the same purpose.
        .. note::
           Using the ``authentication_policy`` argument to the
           :class:`pyramid.config.Configurator` constructor can be used to
           achieve the same purpose.
        """
        def register():
            self._set_authentication_policy(policy)
@@ -41,9 +43,11 @@
        of an authorization policy or a :term:`dotted Python name` that points
        at an instance of an authorization policy.
        .. note:: Using the ``authorization_policy`` argument to the
           :class:`pyramid.config.Configurator` constructor
           can be used to achieve the same purpose.
        .. note::
           Using the ``authorization_policy`` argument to the
           :class:`pyramid.config.Configurator` constructor can be used to
           achieve the same purpose.
        """
        def register():
            self._set_authorization_policy(policy)
@@ -55,7 +59,7 @@
                    'Cannot configure an authorization policy without '
                    'also configuring an authentication policy '
                    '(use the set_authorization_policy method)')
        # authorization policy used by view config (phase 3) and
        # authentication policy (phase 2)
        self.action(IAuthorizationPolicy, register, order=PHASE1_CONFIG)
@@ -98,9 +102,11 @@
        See also :ref:`setting_a_default_permission`.
        .. note:: Using the ``default_permission`` argument to the
           :class:`pyramid.config.Configurator` constructor
           can be used to achieve the same purpose.
        .. note::
           Using the ``default_permission`` argument to the
           :class:`pyramid.config.Configurator` constructor can be used to
           achieve the same purpose.
        """
        # default permission used during view registration (phase 3)
        def register():
pyramid/config/util.py
@@ -258,4 +258,4 @@
        val = (val,)
    val = tuple(sorted(val))
    return val
pyramid/config/views.py
@@ -139,7 +139,7 @@
    def http_cached_view(self, view):
        if self.registry.settings.get('prevent_http_cache', False):
            return view
        seconds = self.kw.get('http_cache')
        if seconds is None:
@@ -365,7 +365,7 @@
        elif self.attr:
            mapped_view = self.map_nonclass_attr(view)
        return mapped_view
    def map_class_requestonly(self, view):
        # its a class that has an __init__ which only accepts request
        attr = self.attr
@@ -713,7 +713,7 @@
          accept ``(context, request)``.  The decorator must return a
          replacement view callable which also accepts ``(context,
          request)``.
        mapper
          A Python object or :term:`dotted Python name` which refers to a
@@ -722,7 +722,7 @@
          plug-point is useful for Pyramid extension developers, but it's not
          very useful for 'civilians' who are just developing stock Pyramid
          applications. Pay no attention to the man behind the curtain.
        Predicate Arguments
        name
@@ -1061,16 +1061,17 @@
        discriminator.extend(sorted(custom_predicates))
        discriminator = tuple(discriminator)
        self.action(discriminator, register)
    def derive_view(self, view, attr=None, renderer=None):
        """
        Create a :term:`view callable` using the function, instance,
        or class (or :term:`dotted Python name` referring to the same)
        provided as ``view`` object.
        .. warning:: This method is typically only used by :app:`Pyramid`
           framework extension authors, not by :app:`Pyramid` application
           developers.
        .. warning::
           This method is typically only used by :app:`Pyramid` framework
           extension authors, not by :app:`Pyramid` application developers.
        This is API is useful to framework extenders who create
        pluggable systems which need to register 'proxy' view
@@ -1173,7 +1174,7 @@
                              mapper=mapper,
                              decorator=decorator,
                              http_cache=http_cache)
        return deriver(view)
    @action_method
@@ -1182,11 +1183,12 @@
        """ Add a default forbidden view to the current configuration
        state.
        .. warning:: This method has been deprecated in :app:`Pyramid`
           1.0.  *Do not use it for new development; it should only be
           used to support older code bases which depend upon it.* See
           :ref:`changing_the_forbidden_view` to see how a forbidden
           view should be registered in new projects.
        .. warning::
           This method has been deprecated in :app:`Pyramid` 1.0.  *Do not use
           it for new development; it should only be used to support older code
           bases which depend upon it.* See :ref:`changing_the_forbidden_view`
           to see how a forbidden view should be registered in new projects.
        The ``view`` argument should be a :term:`view callable` or a
        :term:`dotted Python name` which refers to a view callable.
@@ -1222,12 +1224,12 @@
        """ Add a default not found view to the current configuration
        state.
        .. warning:: This method has been deprecated in
           :app:`Pyramid` 1.0.  *Do not use it for new development;
           it should only be used to support older code bases which
           depend upon it.* See :ref:`changing_the_notfound_view` to
           see how a not found view should be registered in new
           projects.
        .. warning::
           This method has been deprecated in :app:`Pyramid` 1.0.  *Do not use
           it for new development; it should only be used to support older code
           bases which depend upon it.* See :ref:`changing_the_notfound_view` to
           see how a not found view should be registered in new projects.
        The ``view`` argument should be a :term:`view callable` or a
        :term:`dotted Python name` which refers to a view callable.
@@ -1274,7 +1276,9 @@
        See also :ref:`using_a_view_mapper`.
        .. note:: Using the ``default_view_mapper`` argument to the
        .. note::
           Using the ``default_view_mapper`` argument to the
           :class:`pyramid.config.Configurator` constructor
           can be used to achieve the same purpose.
        """
@@ -1483,7 +1487,7 @@
            attr = extra.pop('view_attr', None)
            # register a route using the computed view, permission, and
            # register a route using the computed view, permission, and
            # pattern, plus any extras passed to us via add_static_view
            pattern = "%s*subpath" % name # name already ends with slash
            if config.route_prefix:
pyramid/events.py
@@ -16,7 +16,7 @@
    For example:
    .. code-block:: python
       from pyramid.events import NewRequest
       from pyramid.events import subscriber
@@ -26,9 +26,9 @@
    More than one event type can be passed as a construtor argument.  The
    decorated subscriber will be called for each event type.
    .. code-block:: python
       from pyramid.events import NewRequest, NewResponse
       from pyramid.events import subscriber
@@ -40,7 +40,7 @@
    the function it decorates is called for every event sent:
    .. code-block:: python
       from pyramid.events import subscriber
       @subscriber()
@@ -51,7 +51,7 @@
    against the package or module which contains it, ala:
    .. code-block:: python
       from pyramid.config import Configurator
       config = Configurator()
       config.scan('somepackage_containing_subscribers')
@@ -132,17 +132,18 @@
    This class implements the
    :class:`pyramid.interfaces.IContextFound` interface.
    .. note:: As of :app:`Pyramid` 1.0, for backwards compatibility
       purposes, this event may also be imported as
       :class:`pyramid.events.AfterTraversal`.
    .. note::
       As of :app:`Pyramid` 1.0, for backwards compatibility purposes, this
       event may also be imported as :class:`pyramid.events.AfterTraversal`.
    """
    implements(IContextFound)
    def __init__(self, request):
        self.request = request
AfterTraversal = ContextFound # b/c as of 1.0
class ApplicationCreated(object):
class ApplicationCreated(object):
    """ An instance of this class is emitted as an :term:`event` when
    the :meth:`pyramid.config.Configurator.make_wsgi_app` is
    called.  The instance has an attribute, ``app``, which is an
@@ -150,11 +151,11 @@
    This class implements the
    :class:`pyramid.interfaces.IApplicationCreated` interface.
    .. note:: For backwards compatibility purposes, this class can
       also be imported as
       :class:`pyramid.events.WSGIApplicationCreatedEvent`.  This
       was the name of the event class before :app:`Pyramid` 1.0.
    .. note::
       For backwards compatibility purposes, this class can also be imported as
       :class:`pyramid.events.WSGIApplicationCreatedEvent`.  This was the name
       of the event class before :app:`Pyramid` 1.0.
    """
    implements(IApplicationCreated)
    def __init__(self, app):
pyramid/interfaces.py
@@ -9,7 +9,9 @@
    documentation attached to :class:`pyramid.events.ContextFound`
    for more information.
    .. note:: For backwards compatibility with versions of
    .. note::
       For backwards compatibility with versions of
       :app:`Pyramid` before 1.0, this event interface can also be
       imported as :class:`pyramid.interfaces.IAfterTraversal`.
    """
@@ -22,7 +24,7 @@
    begins to process a new request.  See the documentation attached
    to :class:`pyramid.events.NewRequest` for more information."""
    request = Attribute('The request object')
class INewResponse(Interface):
    """ An event type that is emitted whenever any :app:`Pyramid`
    view returns a response. See the
@@ -38,7 +40,9 @@
    :class:`pyramid.events.ApplicationCreated` for more
    information.
    .. note:: For backwards compatibility with :app:`Pyramid`
    .. note::
       For backwards compatibility with :app:`Pyramid`
       versions before 1.0, this interface can also be imported as
       :class:`pyramid.interfaces.IWSGIApplicationCreatedEvent`.
    """
@@ -151,7 +155,7 @@
        otherwise they will be preserved.""")
    content_type_params = Attribute(
        """A dictionary of all the parameters in the content type.  This is
        """A dictionary of all the parameters in the content type.  This is
        not a view, set to change, modifications of the dict would not
        be applied otherwise.""")
@@ -276,18 +280,18 @@
    def __setitem__(k, value):
        """ Set a key/value pair into the dictionary"""
    def __delitem__(k):
        """ Delete an item from the dictionary which is passed to the
        renderer as the renderer globals dictionary."""
    def __getitem__(k):
        """ Return the value for key ``k`` from the dictionary or raise a
        KeyError if the key doesn't exist"""
    def __iter__():
        """ Return an iterator over the keys of this dictionary """
    def get(k, default=None):
        """ Return the value for key ``k`` from the renderer dictionary, or
        the default if no such value exists."""
@@ -327,7 +331,7 @@
         value into the dictionary under the k name passed.  If a value already
         existed in the dictionary, return it.  If a value did not exist in
         the dictionary, return the default"""
    def update(d):
        """ Update the renderer dictionary with another dictionary ``d``."""
@@ -341,7 +345,7 @@
    The event object itself provides a dictionary-like interface for adding
    and removing :term:`renderer globals`.  The keys and values of the
    dictionary are those globals.  For example::
      from repoze.events import subscriber
      from pyramid.interfaces import IBeforeRender
@@ -424,7 +428,7 @@
        principal named ``principal`` when set in a response.  An
        individual authentication policy and its consumers can decide
        on the composition and meaning of ``**kw.`` """
    def forget(request):
        """ Return a set of headers suitable for 'forgetting' the
        current user on subsequent requests. """
@@ -435,7 +439,7 @@
        """ Return ``True`` if any of the ``principals`` is allowed the
        ``permission`` in the current ``context``, else return ``False``
        """
    def principals_allowed_by_permission(context, permission):
        """ Return a set of principal identifiers allowed by the
        ``permission`` in ``context``.  This behavior is optional; if you
@@ -499,7 +503,7 @@
        The ``request`` argument will be an instance of an object that
        provides IRequest."""
IRequest.combined = IRequest # for exception view lookups
IRequest.combined = IRequest # for exception view lookups
class IRouteRequest(Interface):
    """ *internal only* interface used as in a utility lookup to find
@@ -614,12 +618,12 @@
    a view registry."""
    registry = Attribute(
        """Component architecture registry local to this application.""")
class ISettings(Interface):
    """ Runtime settings utility for pyramid; represents the
    deployment settings for the application.  Implements a mapping
    interface."""
# this interface, even if it becomes unused within Pyramid, is
# imported by other packages (such as traversalwrapper)
class ILocation(Interface):
@@ -749,7 +753,7 @@
class ILocalizer(Interface):
    """ Localizer for a specific language """
class ILocaleNegotiator(Interface):
    def __call__(request):
        """ Return a locale name """
pyramid/paster.py
@@ -56,19 +56,21 @@
    that may be called when your script is complete (it pops a threadlocal
    stack).
    .. note:: Most operations within :app:`Pyramid` expect to be invoked
              within the context of a WSGI request, thus it's important when
              loading your application to anchor it when executing scripts
              and other code that is not normally invoked during active WSGI
              requests.
    .. note::
    .. note:: For a complex config file containing multiple :app:`Pyramid`
              applications, this function will setup the environment under
              the context of the last-loaded :app:`Pyramid` application. You
              may load a specific application yourself by using the
              lower-level functions :meth:`pyramid.paster.get_app` and
              :meth:`pyramid.scripting.prepare` in conjunction with
              :attr:`pyramid.config.global_registries`.
       Most operations within :app:`Pyramid` expect to be invoked within the
       context of a WSGI request, thus it's important when loading your
       application to anchor it when executing scripts and other code that is
       not normally invoked during active WSGI requests.
    .. note::
       For a complex config file containing multiple :app:`Pyramid`
       applications, this function will setup the environment under the context
       of the last-loaded :app:`Pyramid` application. You may load a specific
       application yourself by using the lower-level functions
       :meth:`pyramid.paster.get_app` and :meth:`pyramid.scripting.prepare` in
       conjunction with :attr:`pyramid.config.global_registries`.
    ``config_uri`` -- specifies the PasteDeploy config file to use for the
    interactive shell. The format is ``inifile#name``. If the name is left
@@ -300,7 +302,7 @@
    def out(self, msg): # pragma: no cover
        print msg
    def command(self):
        from pyramid.interfaces import IRouteRequest
        from pyramid.interfaces import IViewClassifier
@@ -359,7 +361,7 @@
    def out(self, msg): # pragma: no cover
        print msg
    def _find_multi_routes(self, mapper, request):
        infos = []
        path = request.environ['PATH_INFO']
@@ -390,7 +392,7 @@
        from pyramid.request import Request
        from pyramid.traversal import DefaultRootFactory
        from pyramid.traversal import ResourceTreeTraverser
        q = registry.queryUtility
        root_factory = q(IRootFactory, default=DefaultRootFactory)
        routes_mapper = q(IRoutesMapper)
@@ -579,7 +581,7 @@
    using an explicit tweens ordering (will be true when the
    ``pyramid.tweens`` setting is used) or an implicit tweens ordering (will
    be true when the ``pyramid.tweens`` setting is *not* used).
    This command accepts one positional argument:
    ``config_uri`` -- specifies the PasteDeploy config file to use for the
pyramid/request.py
@@ -409,7 +409,7 @@
    if new_path_info != '/': # don't want a sole double-slash
        if path_info != '/': # if orig path_info is '/', we're already done
            if path_info.endswith('/'):
                # readd trailing slash stripped by subpath (traversal)
                # readd trailing slash stripped by subpath (traversal)
                # conversion
                new_path_info += '/'
@@ -428,7 +428,7 @@
    # to end of script_name
    while workback and (workback[-1] == ''):
        workback = workback[:-1]
    new_script_name = '/'.join(workback)
    new_request = request.copy()
pyramid/security.py
@@ -109,7 +109,9 @@
    :mod:`pyramid.security.Everyone` (the special principal
    identifier representing all principals).
    .. note:: even if an :term:`authorization policy` is in effect,
    .. note::
       even if an :term:`authorization policy` is in effect,
       some (exotic) authorization policies may not implement the
       required machinery for this function; those will cause a
       :exc:`NotImplementedError` exception to be raised when this
@@ -192,14 +194,14 @@
        return []
    else:
        return policy.forget(request)
class PermitsResult(int):
    def __new__(cls, s, *args):
        inst = int.__new__(cls, cls.boolval)
        inst.s = s
        inst.args = args
        return inst
    @property
    def msg(self):
        return self.s % self.args
pyramid/static.py
@@ -47,7 +47,7 @@
        content_length = getsize(path)
        self.app_iter = _FileIter(open(path, 'rb'), content_length)
        # assignment of content_length must come after assignment of app_iter
        self.content_length = content_length
        self.content_length = content_length
        if cache_max_age is not None:
            self.cache_expires = cache_max_age
@@ -110,13 +110,15 @@
    the static application will consider request.path_info as ``PATH_INFO``
    input. By default, this is ``False``.
    .. note:: If the ``root_dir`` is relative to a :term:`package`, or
         is a :term:`asset specification` the :app:`Pyramid`
         :class:`pyramid.config.Configurator` method can be
         used to override assets within the named ``root_dir``
         package-relative directory.  However, if the ``root_dir`` is
         absolute, configuration will not be able to
         override the assets it contains.  """
    .. note::
       If the ``root_dir`` is relative to a :term:`package`, or is a
       :term:`asset specification` the :app:`Pyramid`
       :class:`pyramid.config.Configurator` method can be used to override
       assets within the named ``root_dir`` package-relative directory.
       However, if the ``root_dir`` is absolute, configuration will not be able
       to override the assets it contains.
    """
    def __init__(self, root_dir, cache_max_age=3600, package_name=None,
                 use_subpath=False, index='index.html'):
pyramid/traversal.py
@@ -125,26 +125,29 @@
    The ``resource`` passed in *must* be :term:`location`-aware.
    .. note:: Each segment in the path string returned will use the
              ``__name__`` attribute of the resource it represents within
              the resource tree.  Each of these segments *should* be a unicode
              or string object (as per the contract of
              :term:`location`-awareness).  However, no conversion or
              safety checking of resource names is performed.  For
              instance, if one of the resources in your tree has a
              ``__name__`` which (by error) is a dictionary, the
              :func:`pyramid.traversal.resource_path` function will
              attempt to append it to a string and it will cause a
              :exc:`pyramid.exceptions.URLDecodeError`.
    .. note::
    .. note:: The :term:`root` resource *must* have a ``__name__``
              attribute with a value of either ``None`` or the empty
              string for paths to be generated properly.  If the root
              resource has a non-null ``__name__`` attribute, its name
              will be prepended to the generated path rather than a
              single leading '/' character.
       Each segment in the path string returned will use the ``__name__``
       attribute of the resource it represents within the resource tree.  Each
       of these segments *should* be a unicode or string object (as per the
       contract of :term:`location`-awareness).  However, no conversion or
       safety checking of resource names is performed.  For instance, if one of
       the resources in your tree has a ``__name__`` which (by error) is a
       dictionary, the :func:`pyramid.traversal.resource_path` function will
       attempt to append it to a string and it will cause a
       :exc:`pyramid.exceptions.URLDecodeError`.
    .. note:: For backwards compatibility purposes, this function can also
    .. note::
       The :term:`root` resource *must* have a ``__name__`` attribute with a
       value of either ``None`` or the empty string for paths to be generated
       properly.  If the root resource has a non-null ``__name__`` attribute,
       its name will be prepended to the generated path rather than a single
       leading '/' character.
    .. note::
       For backwards compatibility purposes, this function can also
       be imported as ``model_path``, although doing so will cause
       a deprecation warning to be emitted.
    """
@@ -298,7 +301,7 @@
        resource = find_root(resource)
    reg = get_current_registry()
    request_factory = reg.queryUtility(IRequestFactory)
    if request_factory is None:
        from pyramid.request import Request # avoid circdep
@@ -331,28 +334,30 @@
    The ``resource`` passed in *must* be :term:`location`-aware.
    .. note:: Each segment in the path tuple returned will equal the
              ``__name__`` attribute of the resource it represents within
              the resource tree.  Each of these segments *should* be a unicode
              or string object (as per the contract of
              :term:`location`-awareness).  However, no conversion or
              safety checking of resource names is performed.  For
              instance, if one of the resources in your tree has a
              ``__name__`` which (by error) is a dictionary, that
              dictionary will be placed in the path tuple; no warning
              or error will be given.
    .. note::
    .. note:: The :term:`root` resource *must* have a ``__name__``
              attribute with a value of either ``None`` or the empty
              string for path tuples to be generated properly.  If
              the root resource has a non-null ``__name__`` attribute,
              its name will be the first element in the generated
              path tuple rather than the empty string.
       Each segment in the path tuple returned will equal the ``__name__``
       attribute of the resource it represents within the resource tree.  Each
       of these segments *should* be a unicode or string object (as per the
       contract of :term:`location`-awareness).  However, no conversion or
       safety checking of resource names is performed.  For instance, if one of
       the resources in your tree has a ``__name__`` which (by error) is a
       dictionary, that dictionary will be placed in the path tuple; no warning
       or error will be given.
    .. note:: For backwards compatibility purposes, this function can also be
       imported as ``model_path_tuple``, although doing so will cause a
       deprecation warning to be emitted.
    .. note::
       The :term:`root` resource *must* have a ``__name__`` attribute with a
       value of either ``None`` or the empty string for path tuples to be
       generated properly.  If the root resource has a non-null ``__name__``
       attribute, its name will be the first element in the generated path tuple
       rather than the empty string.
    .. note::
       For backwards compatibility purposes, this function can also be imported
       as ``model_path_tuple``, although doing so will cause a deprecation
       warning to be emitted.
    """
    return tuple(_resource_path_list(resource, *elements))
@@ -457,18 +462,17 @@
        (u'archives', u'<unprintable unicode>')
    .. note:: This function does not generate the same type of tuples
              that :func:`pyramid.traversal.resource_path_tuple` does.
              In particular, the leading empty string is not present
              in the tuple it returns, unlike tuples returned by
              :func:`pyramid.traversal.resource_path_tuple`.  As a
              result, tuples generated by ``traversal_path`` are not
              resolveable by the
              :func:`pyramid.traversal.find_resource` API.
              ``traversal_path`` is a function mostly used by the
              internals of :app:`Pyramid` and by people writing
              their own traversal machinery, as opposed to users
              writing applications in :app:`Pyramid`.
    .. note::
      This function does not generate the same type of tuples that
      :func:`pyramid.traversal.resource_path_tuple` does.  In particular, the
      leading empty string is not present in the tuple it returns, unlike tuples
      returned by :func:`pyramid.traversal.resource_path_tuple`.  As a result,
      tuples generated by ``traversal_path`` are not resolveable by the
      :func:`pyramid.traversal.find_resource` API.  ``traversal_path`` is a
      function mostly used by the internals of :app:`Pyramid` and by people
      writing their own traversal machinery, as opposed to users writing
      applications in :app:`Pyramid`.
    """
    if isinstance(path, unicode):
        path = path.encode('ascii')
pyramid/url.py
@@ -70,13 +70,14 @@
        data is turned into a query string, a leading ``?`` is prepended,
        and the resulting string is appended to the generated URL.
        .. note:: Python data structures that are passed as ``_query``
                  which are sequences or dictionaries are turned into a
                  string under the same rules as when run through
                  :func:`urllib.urlencode` with the ``doseq`` argument
                  equal to ``True``.  This means that sequences can be
                  passed as values, and a k=v pair will be placed into the
                  query string for each value.
        .. note::
           Python data structures that are passed as ``_query`` which are
           sequences or dictionaries are turned into a string under the same
           rules as when run through :func:`urllib.urlencode` with the ``doseq``
           argument equal to ``True``.  This means that sequences can be passed
           as values, and a k=v pair will be placed into the query string for
           each value.
        If a keyword argument ``_anchor`` is present, its string
        representation will be used as a named anchor in the generated URL
@@ -84,11 +85,12 @@
        ``http://example.com/route/url``, the resulting generated URL will
        be ``http://example.com/route/url#foo``).
        .. note:: If ``_anchor`` is passed as a string, it should be UTF-8
                  encoded. If ``_anchor`` is passed as a Unicode object, it
                  will be converted to UTF-8 before being appended to the
                  URL.  The anchor value is not quoted in any way before
                  being appended to the generated URL.
        .. note::
           If ``_anchor`` is passed as a string, it should be UTF-8 encoded. If
           ``_anchor`` is passed as a Unicode object, it will be converted to
           UTF-8 before being appended to the URL.  The anchor value is not
           quoted in any way before being appended to the generated URL.
        If both ``_anchor`` and ``_query`` are specified, the anchor
        element will always follow the query element,
@@ -177,13 +179,14 @@
        Will return the string ``/1/2``.
        .. note:: Calling ``request.route_path('route')`` is the same as
           calling ``request.route_url('route',
           _app_url=request.script_name)``.
           :meth:`pyramid.request.Request.route_path` is, in fact,
           implemented in terms of `:meth:`pyramid.request.Request.route_url`
           in just this way. As a result, any ``_app_url`` passed within the
           ``**kw`` values to ``route_path`` will be ignored.
        .. note::
           Calling ``request.route_path('route')`` is the same as calling
           ``request.route_url('route', _app_url=request.script_name)``.
           :meth:`pyramid.request.Request.route_path` is, in fact, implemented
           in terms of `:meth:`pyramid.request.Request.route_url` in just this
           way. As a result, any ``_app_url`` passed within the ``**kw`` values
           to ``route_path`` will be ignored.
        """
        kw['_app_url'] = self.script_name
        return self.route_url(route_name, *elements, **kw)
@@ -238,13 +241,14 @@
        into a query string, a leading ``?`` is prepended, and the resulting
        string is appended to the generated URL.
        .. note:: Python data structures that are passed as ``query`` which
                  are sequences or dictionaries are turned into a string
                  under the same rules as when run through
                  :func:`urllib.urlencode` with the ``doseq`` argument equal
                  to ``True``.  This means that sequences can be passed as
                  values, and a k=v pair will be placed into the query string
                  for each value.
        .. note::
           Python data structures that are passed as ``query`` which are
           sequences or dictionaries are turned into a string under the same
           rules as when run through :func:`urllib.urlencode` with the ``doseq``
           argument equal to ``True``.  This means that sequences can be passed
           as values, and a k=v pair will be placed into the query string for
           each value.
        If a keyword argument ``anchor`` is present, its string
        representation will be used as a named anchor in the generated URL
@@ -252,11 +256,12 @@
        ``http://example.com/resource/url``, the resulting generated URL will
        be ``http://example.com/resource/url#foo``).
        .. note:: If ``anchor`` is passed as a string, it should be UTF-8
                  encoded. If ``anchor`` is passed as a Unicode object, it
                  will be converted to UTF-8 before being appended to the
                  URL.  The anchor value is not quoted in any way before
                  being appended to the generated URL.
        .. note::
           If ``anchor`` is passed as a string, it should be UTF-8 encoded. If
           ``anchor`` is passed as a Unicode object, it will be converted to
           UTF-8 before being appended to the URL.  The anchor value is not
           quoted in any way before being appended to the generated URL.
        If both ``anchor`` and ``query`` are specified, the anchor element
        will always follow the query element,
@@ -267,19 +272,24 @@
        the base resource which is operated upon by this function.  See also
        :ref:`overriding_resource_url_generation`.
        .. note:: If the :term:`resource` used is the result of a
                 :term:`traversal`, it must be :term:`location`-aware.  The
                 resource can also be the context of a :term:`URL dispatch`;
                 contexts found this way do not need to be location-aware.
        .. note::
        .. note:: If a 'virtual root path' is present in the request
                  environment (the value of the WSGI environ key
                  ``HTTP_X_VHM_ROOT``), and the resource was obtained via
                  :term:`traversal`, the URL path will not include the
                  virtual root prefix (it will be stripped off the left hand
                  side of the generated URL).
           If the :term:`resource` used is the result of a :term:`traversal`, it
           must be :term:`location`-aware.  The resource can also be the context
           of a :term:`URL dispatch`; contexts found this way do not need to be
           location-aware.
        .. note:: For backwards compatibility purposes, this method is also
        .. note::
           If a 'virtual root path' is present in the request environment (the
           value of the WSGI environ key ``HTTP_X_VHM_ROOT``), and the resource
           was obtained via :term:`traversal`, the URL path will not include the
           virtual root prefix (it will be stripped off the left hand side of
           the generated URL).
        .. note::
           For backwards compatibility purposes, this method is also
           aliased as the ``model_url`` method of request.
        """
        try:
@@ -310,7 +320,7 @@
            suffix = ''
        return resource_url + suffix + qs + anchor
    model_url = resource_url # b/w compat forever
    def static_url(self, path, **kw):
@@ -380,14 +390,14 @@
                                    /static/foo.css
        .. note:: Calling ``request.static_path(apath)`` is the same
           as calling ``request.static_url(apath,
           _app_url=request.script_name)``.
           :meth:`pyramid.request.Request.static_path` is, in fact,
           implemented in terms of
           `:meth:`pyramid.request.Request.static_url` in just this
           way. As a result, any ``_app_url`` passed within the ``**kw``
           values to ``static_path`` will be ignored.
        .. note::
           Calling ``request.static_path(apath)`` is the same as calling
           ``request.static_url(apath, _app_url=request.script_name)``.
           :meth:`pyramid.request.Request.static_path` is, in fact, implemented
           in terms of `:meth:`pyramid.request.Request.static_url` in just this
           way. As a result, any ``_app_url`` passed within the ``**kw`` values
           to ``static_path`` will be ignored.
        """
        if not os.path.isabs(path):
            if not ':' in path:
@@ -478,7 +488,9 @@
        Will return the string ``/1/2``.
        .. note:: Calling ``request.current_route_path('route')`` is the same
        .. note::
           Calling ``request.current_route_path('route')`` is the same
           as calling ``request.current_route_url('route',
           _app_url=request.script_name)``.
           :meth:`pyramid.request.Request.current_route_path` is, in fact,
@@ -489,8 +501,8 @@
        """
        kw['_app_url'] = self.script_name
        return self.current_route_url(*elements, **kw)
def route_url(route_name, request, *elements, **kw):
    """
    This is a backwards compatibility function.  Its result is the same as
pyramid/view.py
@@ -15,7 +15,7 @@
_marker = object()
class static(static_view):
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
@@ -301,7 +301,9 @@
    """ 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
    .. 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."""
    if ( hasattr(ob, 'app_iter') and hasattr(ob, 'headerlist') and