summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt23
-rw-r--r--pyramid/authentication.py6
-rw-r--r--pyramid/authorization.py24
-rw-r--r--pyramid/chameleon_text.py16
-rw-r--r--pyramid/chameleon_zpt.py16
-rw-r--r--pyramid/configuration.py277
-rw-r--r--pyramid/events.py50
-rw-r--r--pyramid/exceptions.py2
-rw-r--r--pyramid/i18n.py8
-rw-r--r--pyramid/interfaces.py55
-rw-r--r--pyramid/log.py2
-rw-r--r--pyramid/paster.py12
-rw-r--r--pyramid/renderers.py10
-rw-r--r--pyramid/request.py27
-rw-r--r--pyramid/router.py5
-rw-r--r--pyramid/scripting.py2
-rw-r--r--pyramid/security.py27
-rw-r--r--pyramid/settings.py6
-rw-r--r--pyramid/static.py6
-rw-r--r--pyramid/testing.py174
-rw-r--r--pyramid/tests/test_configuration.py71
-rw-r--r--pyramid/traversal.py53
-rw-r--r--pyramid/url.py14
-rw-r--r--pyramid/view.py67
-rw-r--r--pyramid/wsgi.py18
-rw-r--r--pyramid/zcml.py3
26 files changed, 365 insertions, 609 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 242e4bfe8..5fa214281 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,8 +1,8 @@
Next release
============
-Backwards Incompatibilities
----------------------------
+Backwards Incompatibilities (with BFG 1.3.X)
+--------------------------------------------
- The ``pyramid.testing.registerRoutesMapper`` API (deprecated in BFG
1.2) has been removed.
@@ -10,3 +10,22 @@ Backwards Incompatibilities
- The ``pyramid.testing.registerViewPermission`` API (deprecated in
BFG 1.1) has been removed.
+- There is no longer an ``IDebugLogger`` registered as a named utility
+ with the name ``repoze.bfg.debug``.
+
+- The logger which used to have the name of ``repoze.bfg.debug`` now
+ has the name ``pyramid.debug``.
+
+- The deprecated API named ``pyramid.router.make_app`` (aka
+ ``pyramid.configuration.make_app) was removed.
+
+- The deprecated API named ``pyramid.request.get_request`` was removed.
+
+- The deprecated API named ``pyramid.security.Unauthorized`` was
+ removed.
+
+- The deprecated API named ``pyramid.view.view_execution_permitted``
+ was removed.
+
+- The deprecated API named ``pyramid.view.NotFound`` was removed.
+
diff --git a/pyramid/authentication.py b/pyramid/authentication.py
index 443f91428..126ed5ec8 100644
--- a/pyramid/authentication.py
+++ b/pyramid/authentication.py
@@ -44,7 +44,7 @@ class CallbackAuthenticationPolicy(object):
class RepozeWho1AuthenticationPolicy(CallbackAuthenticationPolicy):
- """ A :mod:`repoze.bfg` :term:`authentication policy` which
+ """ A :mod:`pyramid` :term:`authentication policy` which
obtains data from the :mod:`repoze.who` 1.X WSGI 'API' (the
``repoze.who.identity`` key in the WSGI environment).
@@ -123,7 +123,7 @@ class RepozeWho1AuthenticationPolicy(CallbackAuthenticationPolicy):
return identifier.forget(request.environ, identity)
class RemoteUserAuthenticationPolicy(CallbackAuthenticationPolicy):
- """ A :mod:`repoze.bfg` :term:`authentication policy` which
+ """ A :mod:`pyramid` :term:`authentication policy` which
obtains data from the ``REMOTE_USER`` WSGI environment variable.
Constructor Arguments
@@ -157,7 +157,7 @@ class RemoteUserAuthenticationPolicy(CallbackAuthenticationPolicy):
return []
class AuthTktAuthenticationPolicy(CallbackAuthenticationPolicy):
- """ A :mod:`repoze.bfg` :term:`authentication policy` which
+ """ A :mod:`pyramid` :term:`authentication policy` which
obtains data from an :class:`paste.auth.auth_tkt` cookie.
Constructor Arguments
diff --git a/pyramid/authorization.py b/pyramid/authorization.py
index d06069c63..4d2f3eb0e 100644
--- a/pyramid/authorization.py
+++ b/pyramid/authorization.py
@@ -25,32 +25,32 @@ class ACLAuthorizationPolicy(object):
context's parent ACL, and so on, until the lineage is exhausted
or we determine that the policy permits or denies.
- During this processing, if any :data:`repoze.bfg.security.Deny`
+ During this processing, if any :data:`pyramid.security.Deny`
ACE is found matching any principal in ``principals``, stop
processing by returning an
- :class:`repoze.bfg.security.ACLDenied` instance (equals
+ :class:`pyramid.security.ACLDenied` instance (equals
``False``) immediately. If any
- :data:`repoze.bfg.security.Allow` ACE is found matching any
+ :data:`pyramid.security.Allow` ACE is found matching any
principal, stop processing by returning an
- :class:`repoze.bfg.security.ACLAllowed` instance (equals
+ :class:`pyramid.security.ACLAllowed` instance (equals
``True``) immediately. If we exhaust the context's
:term:`lineage`, and no ACE has explicitly permitted or denied
access, return an instance of
- :class:`repoze.bfg.security.ACLDenied` (equals ``False``).
+ :class:`pyramid.security.ACLDenied` (equals ``False``).
- When computing principals allowed by a permission via the
- :func:`repoze.bfg.security.principals_allowed_by_permission`
+ :func:`pyramid.security.principals_allowed_by_permission`
method, we compute the set of principals that are explicitly
granted the ``permission`` in the provided ``context``. We do
this by walking 'up' the object graph *from the root* to the
context. During this walking process, if we find an explicit
- :data:`repoze.bfg.security.Allow` ACE for a principal that
+ :data:`pyramid.security.Allow` ACE for a principal that
matches the ``permission``, the principal is included in the
allow list. However, if later in the walking process that
- principal is mentioned in any :data:`repoze.bfg.security.Deny`
+ principal is mentioned in any :data:`pyramid.security.Deny`
ACE for the permission, the principal is removed from the allow
- list. If a :data:`repoze.bfg.security.Deny` to the principal
- :data:`repoze.bfg.security.Everyone` is encountered during the
+ list. If a :data:`pyramid.security.Deny` to the principal
+ :data:`pyramid.security.Everyone` is encountered during the
walking process that matches the ``permission``, the allow list
is cleared for all principals encountered in previous ACLs. The
walking process ends after we've processed the any ACL directly
@@ -61,9 +61,9 @@ class ACLAuthorizationPolicy(object):
def permits(self, context, principals, permission):
""" Return an instance of
- :class:`repoze.bfg.security.ACLAllowed` instance if the policy
+ :class:`pyramid.security.ACLAllowed` instance if the policy
permits access, return an instance of
- :class:`repoze.bfg.security.ACLDenied` if not."""
+ :class:`pyramid.security.ACLDenied` if not."""
acl = '<No ACL found on any object in model lineage>'
diff --git a/pyramid/chameleon_text.py b/pyramid/chameleon_text.py
index 337075c36..c50b4cb44 100644
--- a/pyramid/chameleon_text.py
+++ b/pyramid/chameleon_text.py
@@ -84,8 +84,8 @@ def get_renderer(path):
package-relative path, an absolute path, or a :term:`resource
specification`.
- .. warning:: This API is deprecated in :mod:`repoze.bfg` 1.3. Use
- :func:`repoze.bfg.renderers.get_renderer` instead.
+ .. warning:: This API is deprecated in :mod:`pyramid` 1.0. Use
+ :func:`pyramid.renderers.get_renderer` instead.
"""
package = caller_package()
factory = renderers.RendererHelper(path, package=package)
@@ -97,9 +97,9 @@ def get_template(path):
The ``path`` argument may be a package-relative path, an absolute
path, or a :term:`resource specification`.
- .. warning:: This API is deprecated in :mod:`repoze.bfg` 1.3. Use
+ .. warning:: This API is deprecated in :mod:`pyramid` 1.0. Use
the ``implementation()`` method of a template renderer retrieved via
- :func:`repoze.bfg.renderers.get_renderer` instead.
+ :func:`pyramid.renderers.get_renderer` instead.
"""
package = caller_package()
factory = renderers.RendererHelper(path, package=package)
@@ -113,8 +113,8 @@ def render_template(path, **kw):
names to the template, and so may be used within the template
itself. Returns a string.
- .. warning:: This API is deprecated in :mod:`repoze.bfg` 1.3. Use
- :func:`repoze.bfg.renderers.render` instead.
+ .. warning:: This API is deprecated in :mod:`pyramid` 1.0. Use
+ :func:`pyramid.renderers.render` instead.
"""
package = caller_package()
request = kw.pop('request', None)
@@ -130,8 +130,8 @@ def render_template_to_response(path, **kw):
itself. Returns a :term:`Response` object with the body as the
template result.
- .. warning:: This API is deprecated in :mod:`repoze.bfg` 1.3. Use
- :func:`repoze.bfg.renderers.render_to_response` instead.
+ .. warning:: This API is deprecated in :mod:`pyramid` 1.0. Use
+ :func:`pyramid.renderers.render_to_response` instead.
"""
package = caller_package()
request = kw.pop('request', None)
diff --git a/pyramid/chameleon_zpt.py b/pyramid/chameleon_zpt.py
index beedd6fc9..a9671c411 100644
--- a/pyramid/chameleon_zpt.py
+++ b/pyramid/chameleon_zpt.py
@@ -66,8 +66,8 @@ def get_renderer(path):
package-relative path, an absolute path, or a :term:`resource
specification`.
- .. warning:: This API is deprecated in :mod:`repoze.bfg` 1.3. Use
- :func:`repoze.bfg.renderers.get_renderer` instead.
+ .. warning:: This API is deprecated in :mod:`pyramid` 1.0. Use
+ :func:`pyramid.renderers.get_renderer` instead.
"""
package = caller_package()
factory = renderers.RendererHelper(path, package=package)
@@ -79,9 +79,9 @@ def get_template(path):
The ``path`` argument may be a package-relative path, an absolute
path, or a :term:`resource specification`.
- .. warning:: This API is deprecated in :mod:`repoze.bfg` 1.3. Use
+ .. warning:: This API is deprecated in :mod:`pyramid` 1.0. Use
the ``implementation()`` method of a template renderer retrieved via
- :func:`repoze.bfg.renderers.get_renderer` instead.
+ :func:`pyramid.renderers.get_renderer` instead.
"""
package = caller_package()
factory = renderers.RendererHelper(path, package=package)
@@ -95,8 +95,8 @@ def render_template(path, **kw):
names to the template, and so may be used within the template
itself. Returns a string.
- .. warning:: This API is deprecated in :mod:`repoze.bfg` 1.3. Use
- :func:`repoze.bfg.renderers.render` instead.
+ .. warning:: This API is deprecated in :mod:`pyramid` 1.0. Use
+ :func:`pyramid.renderers.render` instead.
"""
package = caller_package()
request = kw.pop('request', None)
@@ -112,8 +112,8 @@ def render_template_to_response(path, **kw):
itself. Returns a :term:`Response` object with the body as the
template result.
- .. warning:: This API is deprecated in :mod:`repoze.bfg` 1.3. Use
- :func:`repoze.bfg.renderers.render_to_response` instead.
+ .. warning:: This API is deprecated in :mod:`pyramid` 1.0. Use
+ :func:`pyramid.renderers.render_to_response` instead.
"""
package = caller_package()
request = kw.pop('request', None)
diff --git a/pyramid/configuration.py b/pyramid/configuration.py
index e333b6de9..ecb7cc9da 100644
--- a/pyramid/configuration.py
+++ b/pyramid/configuration.py
@@ -90,7 +90,7 @@ _marker = object()
class Configurator(object):
"""
- A Configurator is used to configure a :mod:`repoze.bfg`
+ A Configurator is used to configure a :mod:`pyramid`
:term:`application registry`.
The Configurator accepts a number of arguments: ``registry``,
@@ -100,10 +100,10 @@ class Configurator(object):
``renderer_globals_factory``.
If the ``registry`` argument is passed as a non-``None`` value, it
- must be an instance of the :class:`repoze.bfg.registry.Registry`
+ must be an instance of the :class:`pyramid.registry.Registry`
class representing the registry to configure. If ``registry`` is
``None``, the configurator will create a
- :class:`repoze.bfg.registry.Registry` instance itself; it will
+ :class:`pyramid.registry.Registry` instance itself; it will
also perform some default configuration that would not otherwise
be done. After construction, the configurator may be used to add
configuration to the registry. The overall state of a registry is
@@ -125,8 +125,8 @@ class Configurator(object):
If the ``settings`` argument is passed, it should be a Python
dictionary representing the deployment settings for this
application. These are later retrievable using the
- :meth:`repoze.bfg.configuration.Configurator.get_settings` and
- :func:`repoze.bfg.settings.get_settings` APIs.
+ :meth:`pyramid.configuration.Configurator.get_settings` and
+ :func:`pyramid.settings.get_settings` APIs.
If the ``root_factory`` argument is passed, it should be an object
representing the default :term:`root factory` for your application
@@ -149,14 +149,14 @@ class Configurator(object):
representing a set of :term:`renderer` factories which should be
configured into this application (each tuple representing a set of
positional values that should be passed to
- :meth:`repoze.bfg.configuration.Configurator.add_renderer`). If
+ :meth:`pyramid.configuration.Configurator.add_renderer`). If
it is not passed, a default set of renderer factories is used.
If ``debug_logger`` is not passed, a default debug logger that
logs to stderr will be used. If it is passed, it should be an
instance of the :class:`logging.Logger` (PEP 282) standard library
class or a :term:`dotted Python name` to same. The debug logger
- is used by :mod:`repoze.bfg` itself to log warnings and
+ is used by :mod:`pyramid` itself to log warnings and
authorization debugging information.
If ``locale_negotiator`` is passed, it should be a :term:`locale
@@ -242,13 +242,13 @@ class Configurator(object):
self.registry.registerUtility(factory, IDefaultRootFactory) # b/c
def _set_authentication_policy(self, policy, _info=u''):
- """ Add a :mod:`repoze.bfg` :term:`authentication policy` to
+ """ Add a :mod:`pyramid` :term:`authentication policy` to
the current configuration."""
policy = self.maybe_dotted(policy)
self.registry.registerUtility(policy, IAuthenticationPolicy, info=_info)
def _set_authorization_policy(self, policy, _info=u''):
- """ Add a :mod:`repoze.bfg` :term:`authorization policy` to
+ """ Add a :mod:`pyramid` :term:`authorization policy` to
the current configuration state (also accepts a :term:`dotted
Python name`."""
policy = self.maybe_dotted(policy)
@@ -310,7 +310,7 @@ class Configurator(object):
def _fix_registry(self):
""" Fix up a ZCA component registry that is not a
- repoze.bfg.registry.Registry by adding analogues of
+ pyramid.registry.Registry by adding analogues of
``has_listeners`` and ``notify`` through monkey-patching."""
if not hasattr(self.registry, 'notify'):
@@ -363,13 +363,13 @@ class Configurator(object):
:term:`Configurator` constructor, no initial 'setup' is
performed against the registry. This is because the registry
you pass in may have already been initialized for use under
- :mod:`repoze.bfg` via a different configurator. However, in
+ :mod:`pyramid` via a different configurator. However, in
some circumstances, such as when you want to use the Zope
'global` registry instead of a registry created as a result of
the Configurator constructor, or when you want to reset the
initial setup of a registry, you *do* want to explicitly
initialize the registry associated with a Configurator for use
- under :mod:`repoze.bfg`. Use ``setup_registry`` to do this
+ under :mod:`pyramid`. Use ``setup_registry`` to do this
initialization.
``setup_registry`` configures settings, a root factory,
@@ -382,11 +382,9 @@ class Configurator(object):
self._set_root_factory(root_factory)
debug_logger = self.maybe_dotted(debug_logger)
if debug_logger is None:
- debug_logger = make_stream_logger('repoze.bfg.debug', sys.stderr)
+ debug_logger = make_stream_logger('pyramid.debug', sys.stderr)
registry = self.registry
registry.registerUtility(debug_logger, IDebugLogger)
- registry.registerUtility(debug_logger, IDebugLogger,
- 'repoze.bfg.debug') # b /c
if authentication_policy or authorization_policy:
self._set_security_policies(authentication_policy,
authorization_policy)
@@ -410,11 +408,11 @@ class Configurator(object):
def hook_zca(self, getSiteManager=None):
""" Call :func:`zope.component.getSiteManager.sethook` with
the argument
- :data:`repoze.bfg.threadlocal.get_current_registry`, causing
+ :data:`pyramid.threadlocal.get_current_registry`, causing
the :term:`Zope Component Architecture` 'global' APIs such as
:func:`zope.component.getSiteManager`,
:func:`zope.component.getAdapter` and others to use the
- :mod:`repoze.bfg` :term:`application registry` rather than the
+ :mod:`pyramid` :term:`application registry` rather than the
Zope 'global' registry. If :mod:`zope.component` cannot be
imported, this method will raise an :exc:`ImportError`."""
if getSiteManager is None:
@@ -425,7 +423,7 @@ class Configurator(object):
def unhook_zca(self, getSiteManager=None):
""" Call :func:`zope.component.getSiteManager.reset` to undo
the action of
- :meth:`repoze.bfg.configuration.Configurator.hook_zca`. If
+ :meth:`pyramid.configuration.Configurator.hook_zca`. If
:mod:`zope.component` cannot be imported, this method will
raise an :exc:`ImportError`."""
if getSiteManager is None: # pragma: no cover
@@ -438,7 +436,7 @@ class Configurator(object):
registry` implied by ``registry`` attribute of this
configurator and the :term:`request` implied by the
``request`` argument on to the :term:`thread local` stack
- consulted by various :mod:`repoze.bfg.threadlocal` API
+ consulted by various :mod:`pyramid.threadlocal` API
functions."""
self.manager.push({'registry':self.registry, 'request':request})
@@ -460,12 +458,12 @@ class Configurator(object):
This is API is useful to framework extenders who create
pluggable systems which need to register 'proxy' view
callables for functions, instances, or classes which meet the
- requirements of being a :mod:`repoze.bfg` view callable. For
+ requirements of being a :mod:`pyramid` view callable. For
example, a ``some_other_framework`` function in another
framework may want to allow a user to supply a view callable,
but he may want to wrap the view callable in his own before
- registering the wrapper as a :mod:`repoze.bfg` view callable.
- Because a :mod:`repoze.bfg` view callable can be any of a
+ registering the wrapper as a :mod:`pyramid` view callable.
+ Because a :mod:`pyramid` view callable can be any of a
number of valid objects, the framework extender will not know
how to call the user-supplied object. Running it through
``derive_view`` normalizes it to a callable which accepts two
@@ -531,7 +529,7 @@ class Configurator(object):
``subscriber`` argument represents a callable object (or a
:term:`dotted Python name` which identifies a callable); it
will be called with a single object ``event`` whenever
- :mod:`repoze.bfg` emits an :term:`event` associated with the
+ :mod:`pyramid` emits an :term:`event` associated with the
``iface``, which may be an :term:`interface` or a class or a
:term:`dotted Python name` to a global object representing an
interface or a class. Using the default ``iface`` value,
@@ -552,8 +550,8 @@ class Configurator(object):
Configurator constructor with one or more 'setting' key/value
pairs. A setting is a single key/value pair in the
dictionary-ish object returned from the API
- :func:`repoze.bfg.settings.get_settings` and
- :meth:`repoze.bfg.configuration.Configurator.get_settings`.
+ :func:`pyramid.settings.get_settings` and
+ :meth:`pyramid.configuration.Configurator.get_settings`.
You may pass a dictionary::
@@ -564,11 +562,10 @@ class Configurator(object):
config.add_settings(external_uri='http://example.com')
This function is useful when you need to test code that calls
- the :func:`repoze.bfg.settings.get_settings` API (or the
- :meth:`repoze.bfg.configuration.Configurator.get_settings`
+ the :func:`pyramid.settings.get_settings` API (or the
+ :meth:`pyramid.configuration.Configurator.get_settings`
API) and which uses return values from that API.
- .. note:: This method is new as of :mod:`repoze.bfg` 1.2.
"""
if settings is None:
settings = {}
@@ -583,20 +580,20 @@ class Configurator(object):
Return a 'settings' object for the current application. A
'settings' object is a dictionary-like object that contains
key/value pairs based on the dictionary passed as the ``settings``
- argument to the :class:`repoze.bfg.configuration.Configurator`
- constructor or the :func:`repoze.bfg.router.make_app` API.
+ argument to the :class:`pyramid.configuration.Configurator`
+ constructor or the :func:`pyramid.router.make_app` API.
.. note:: For backwards compatibility, dictionary keys can also be
looked up as attributes of the settings object.
- .. note:: the :class:`repoze.bfg.settings.get_settings` function
+ .. note:: the :class:`pyramid.settings.get_settings` function
performs the same duty."""
return self.registry.queryUtility(ISettings)
def make_wsgi_app(self):
- """ Returns a :mod:`repoze.bfg` WSGI application representing
+ """ Returns a :mod:`pyramid` WSGI application representing
the current configuration state and sends a
- :class:`repoze.bfg.interfaces.IApplicationCreated`
+ :class:`pyramid.interfaces.IApplicationCreated`
event to all listeners."""
from pyramid.router import Router # avoid circdep
app = Router(self.registry)
@@ -643,7 +640,7 @@ class Configurator(object):
down below into *predicate* arguments and *non-predicate*
arguments. Predicate arguments narrow the circumstances in
which the view callable will be invoked when a request is
- presented to :mod:`repoze.bfg`; non-predicate arguments are
+ presented to :mod:`pyramid`; non-predicate arguments are
informational.
Non-Predicate Arguments
@@ -666,9 +663,9 @@ class Configurator(object):
security and permissions. If ``permission`` is omitted, a
*default* permission may be used for this view registration
if one was named as the
- :class:`repoze.bfg.configuration.Configurator` constructor's
+ :class:`pyramid.configuration.Configurator` constructor's
``default_permission`` argument, or if
- :meth:`repoze.bfg.configuration.Configurator.set_default_permission`
+ :meth:`pyramid.configuration.Configurator.set_default_permission`
was used prior to this view registration. Pass ``None`` as
the permission to explicitly indicate that the view should
always be executable by entirely anonymous users, regardless
@@ -724,7 +721,7 @@ class Configurator(object):
The ``renderer`` attribute is optional. If it is not
defined, the "null" renderer is assumed (no rendering is
performed and the value is passed back to the upstream
- :mod:`repoze.bfg` machinery unmolested).
+ :mod:`pyramid` machinery unmolested).
wrapper
@@ -740,7 +737,7 @@ class Configurator(object):
:ref:`view_lookup`. The "best" wrapper view will be found
based on the lookup ordering: "under the hood" this wrapper
view is looked up via
- ``repoze.bfg.view.render_view_to_response(context, request,
+ ``pyramid.view.render_view_to_response(context, request,
'wrapper_viewname')``. The context and request of a wrapper
view is the same context and request of the inner view. If
this attribute is unspecified, no view wrapping is done.
@@ -882,7 +879,6 @@ class Configurator(object):
``True``, the associated view callable will be considered
viable for a given request.
- .. note:: This feature is new as of :mod:`repoze.bfg` 1.2.
"""
view = self.maybe_dotted(view)
context = self.maybe_dotted(context)
@@ -1097,7 +1093,7 @@ class Configurator(object):
A Python object (often a function or a class) or a
:term:`dotted Python name` which refers to the same object
- that will generate a :mod:`repoze.bfg` :term:`context`
+ that will generate a :mod:`pyramid` :term:`context`
object when this route matches. For example,
``mypackage.models.MyFactoryClass``. If this argument is
not specified, a default root factory will be used.
@@ -1146,20 +1142,16 @@ class Configurator(object):
ignored when attached to a route that has a ``*traverse``
remainder marker in its pattern.
- .. note:: This feature is new as of :mod:`repoze.bfg` 1.3.
-
pregenerator
This option should be a callable object that implements the
- :class:`repoze.bfg.interfaces.IRoutePregenerator`
+ :class:`pyramid.interfaces.IRoutePregenerator`
interface. A :term:`pregenerator` is a callable called by
- the :mod:`repoze.bfg.url.route_url` function to augment or
+ the :mod:`pyramid.url.route_url` function to augment or
replace the arguments it is passed when generating a URL
for the route. This is a feature not often used directly
by applications, it is meant to be hooked by frameworks
- that use :mod:`repoze.bfg` as a base.
-
- .. note:: This feature is new as of :mod:`repoze.bfg` 1.3.
+ that use :mod:`pyramid` as a base.
Predicate Arguments
@@ -1172,11 +1164,10 @@ class Configurator(object):
continues.
.. note:: For backwards compatibility purposes (as of
- :mod:`repoze.bfg` 1.3), 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.
+ :mod:`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
@@ -1268,12 +1259,6 @@ class Configurator(object):
:ref:`custom_route_predicates` for more information about
``info``.
- .. note:: This feature is new as of :mod:`repoze.bfg` 1.2.
-
- .. note:: The ``info`` argument passed to a custom predicate
- in versions prior to :mod:`repoze.bfg` 1.3 was
- always ``None``.
-
View-Related Arguments
view
@@ -1354,8 +1339,6 @@ class Configurator(object):
that otherwise matches the context, request, and view name
(but which does not match the route_name predicate).
- .. note:: This feature is new as of :mod:`repoze.bfg` 1.2.
-
"""
# these are route predicates; if they do not match, the next route
# in the routelist will be tried
@@ -1422,7 +1405,7 @@ class Configurator(object):
def scan(self, package=None, categories=None, _info=u''):
""" Scan a Python package and any of its subpackages for
objects marked with :term:`configuration decoration` such as
- :class:`repoze.bfg.view.bfg_view`. Any decorated object found
+ :class:`pyramid.view.bfg_view`. Any decorated object found
will influence the current configuration state.
The ``package`` argument should be a Python :term:`package` or
@@ -1437,12 +1420,12 @@ class Configurator(object):
By default, ``categories`` is ``None`` which will execute
*all* Venusian decorator callbacks including
- :mod:`repoze.bfg`-related decorators such as ``bfg_view``. If
+ :mod:`pyramid`-related decorators such as ``bfg_view``. If
this is not desirable because the codebase has other
Venusian-using decorators that aren't meant to be invoked
during a particular scan, use ``('bfg',)`` as a ``categories``
value to limit the execution of decorator callbacks to only
- those registered by :mod:`repoze.bfg` itself. Or pass a
+ those registered by :mod:`pyramid` itself. Or pass a
sequence of Venusian scan categories as necessary
(e.g. ``('bfg', 'myframework')``) to limit the decorators
called to the set of categories required.
@@ -1456,7 +1439,7 @@ class Configurator(object):
def add_renderer(self, name, factory, _info=u''):
"""
- Add a :mod:`repoze.bfg` :term:`renderer` factory to the
+ Add a :mod:`pyramid` :term:`renderer` factory to the
current configuration state.
The ``name`` argument is the renderer name.
@@ -1478,7 +1461,7 @@ class Configurator(object):
def override_resource(self, to_override, override_with,
_info=u'', _override=None,):
- """ Add a :mod:`repoze.bfg` resource override to the current
+ """ Add a :mod:`pyramid` resource override to the current
configuration state.
``to_override`` is a :term:`resource specification` to the
@@ -1529,22 +1512,11 @@ class Configurator(object):
""" Add a default forbidden view to the current configuration
state.
- .. warning:: This method has been deprecated in
- :mod:`repoze.bfg` 1.3. *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.
-
- .. note:: For backwards compatibility with :mod:`repoze.bfg`
- 1.2, unlike an 'exception view' as described in
- :ref:`exception_views`, a ``context, request`` view
- callable registered using this API should not expect to
- receive the exception as its first (``context``) argument.
- Instead it should expect to receive the 'real' context as
- found via context-finding or ``None`` if no context could
- be found. The exception causing the registered view to be
- called is however still available as ``request.exception``.
+ .. warning:: This method has been deprecated in :mod:`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.
@@ -1556,7 +1528,7 @@ class Configurator(object):
The ``renderer`` argument should be the name of (or path to) a
:term:`renderer` used to generate a response for this view
(see the
- :meth:`repoze.bfg.configuration.Configurator.add_view`
+ :meth:`pyramid.configuration.Configurator.add_view`
method's ``renderer`` argument for information about how a
configurator relates to a renderer).
@@ -1576,22 +1548,12 @@ class Configurator(object):
state.
.. warning:: This method has been deprecated in
- :mod:`repoze.bfg` 1.3. *Do not use it for new development;
+ :mod:`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.
- ..note:: For backwards compatibility with :mod:`repoze.bfg`
- 1.2, unlike an 'exception view' as described in
- :ref:`exception_views`, a ``context, request`` view
- callable registered using this API should not expect to
- receive the exception as its first (``context``) argument.
- Instead it should expect to receive the 'real' context as
- found via context-finding or ``None`` if no context could
- be found. The exception causing the registered view to be
- called is however still available as ``request.exception``.
-
The ``view`` argument should be a :term:`view callable` or a
:term:`dotted Python name` which refers to a view callable.
@@ -1602,7 +1564,7 @@ class Configurator(object):
The ``renderer`` argument should be the name of (or path to) a
:term:`renderer` used to generate a response for this view
(see the
- :meth:`repoze.bfg.configuration.Configurator.add_view`
+ :meth:`pyramid.configuration.Configurator.add_view`
method's ``renderer`` argument for information about how a
configurator relates to a renderer).
@@ -1620,14 +1582,14 @@ class Configurator(object):
def set_request_factory(self, factory):
""" The object passed as ``factory`` should be an object (or a
:term:`dotted Python name` which refers to an object) which
- will be used by the :mod:`repoze.bfg` router to create all
+ will be used by the :mod:`pyramid` router to create all
request objects. This factory object must have the same
methods and attributes as the
- :class:`repoze.bfg.request.Request` class (particularly
+ :class:`pyramid.request.Request` class (particularly
``__call__``, and ``blank``).
.. note:: Using the :meth:``request_factory`` argument to the
- :class:`repoze.bfg.configuration.Configurator` constructor
+ :class:`pyramid.configuration.Configurator` constructor
can be used to achieve the same purpose.
"""
factory = self.maybe_dotted(factory)
@@ -1636,7 +1598,7 @@ class Configurator(object):
def set_renderer_globals_factory(self, factory):
""" The object passed as ``factory`` should be an callable (or
a :term:`dotted Python name` which refers to an callable) that
- will be used by the :mod:`repoze.bfg` rendering machinery as a
+ will be used by the :mod:`pyramid` rendering machinery as a
renderers global factory (see :ref:`adding_renderer_globals`).
The ``factory`` callable must accept a single argument named
@@ -1648,7 +1610,7 @@ class Configurator(object):
.. note:: Using the :meth:`renderer_globals_factory`
argument to the
- :class:`repoze.bfg.configuration.Configurator` constructor
+ :class:`pyramid.configuration.Configurator` constructor
can be used to achieve the same purpose.
"""
factory = self.maybe_dotted(factory)
@@ -1668,10 +1630,8 @@ class Configurator(object):
application. See :ref:`activating_translation` for more
information.
- .. note: This API is new as of :mod:`repoze.bfg` version 1.3.
-
.. note:: Using the ``locale_negotiator`` argument to the
- :class:`repoze.bfg.configuration.Configurator` constructor
+ :class:`pyramid.configuration.Configurator` constructor
can be used to achieve the same purpose.
"""
negotiator = self.maybe_dotted(negotiator)
@@ -1699,10 +1659,8 @@ class Configurator(object):
See also :ref:`setting_a_default_permission`.
- .. note: This API is new as of :mod:`repoze.bfg` version 1.3.
-
.. note:: Using the ``default_permission`` argument to the
- :class:`repoze.bfg.configuration.Configurator` constructor
+ :class:`pyramid.configuration.Configurator` constructor
can be used to achieve the same purpose.
"""
self.registry.registerUtility(permission, IDefaultPermission)
@@ -1721,7 +1679,6 @@ class Configurator(object):
add_translations_dirs('/usr/share/locale', 'some.package:locale')
- .. note: This API is new as of :mod:`repoze.bfg` version 1.3.
"""
for spec in specs:
@@ -1778,15 +1735,15 @@ class Configurator(object):
*Usage*
The ``add_static_view`` function is typically used in
- conjunction with the :func:`repoze.bfg.url.static_url`
+ conjunction with the :func:`pyramid.url.static_url`
function. ``add_static_view`` adds a view which renders a
static resource when some URL is visited;
- :func:`repoze.bfg.url.static_url` generates a URL to that
+ :func:`pyramid.url.static_url` generates a URL to that
resource.
The ``name`` argument to ``add_static_view`` is usually a
:term:`view name`. When this is the case, the
- :func:`repoze.bfg.url.static_url` API will generate a URL
+ :func:`pyramid.url.static_url` API will generate a URL
which points to a BFG view, which will serve up a set of
resources that live in the package itself. For example:
@@ -1795,7 +1752,7 @@ class Configurator(object):
add_static_view('images', 'mypackage:images/')
Code that registers such a view can generate URLs to the view
- via :func:`repoze.bfg.url.static_url`:
+ via :func:`pyramid.url.static_url`:
.. code-block:: python
@@ -1803,7 +1760,7 @@ class Configurator(object):
When ``add_static_view`` is called with a ``name`` argument
that represents a simple view name, as it is above, subsequent
- calls to :func:`repoze.bfg.url.static_url` with paths that
+ calls to :func:`pyramid.url.static_url` with paths that
start with the ``path`` argument passed to ``add_static_view``
will generate a URL something like ``http://<BFG app
URL>/images/logo.png``, which will cause the ``logo.png`` file
@@ -1816,7 +1773,7 @@ class Configurator(object):
``name`` argument is a URL (detected as any string with a
slash in it). In this mode, the ``name`` is used as the URL
prefix when generating a URL using
- :func:`repoze.bfg.url.static_url`. For example, if
+ :func:`pyramid.url.static_url`. For example, if
``add_static_view`` is called like so:
.. code-block:: python
@@ -1824,7 +1781,7 @@ class Configurator(object):
add_static_view('http://example.com/images', 'mypackage:images/')
Subsequently, the URLs generated by
- :func:`repoze.bfg.url.static_url` for that static view will be
+ :func:`pyramid.url.static_url` for that static view will be
prefixed with ``http://example.com/images``:
.. code-block:: python
@@ -1833,7 +1790,7 @@ class Configurator(object):
When ``add_static_view`` is called with a ``name`` argument
that is the URL prefix ``http://example.com/images``,
- subsequent calls to :func:`repoze.bfg.url.static_url` with
+ subsequent calls to :func:`pyramid.url.static_url` with
paths that start with the ``path`` argument passed to
``add_static_view`` will generate a URL something like
``http://example.com/logo.png``. The external webserver
@@ -1854,7 +1811,7 @@ class Configurator(object):
def testing_securitypolicy(self, userid=None, groupids=(),
permissive=True):
"""Unit/integration testing helper: Registers a pair of faux
- :mod:`repoze.bfg` security policies: a :term:`authentication
+ :mod:`pyramid` security policies: a :term:`authentication
policy` and a :term:`authorization policy`.
The behavior of the registered :term:`authorization policy`
@@ -1869,15 +1826,15 @@ class Configurator(object):
``groupids`` argument. The authentication policy will return
the userid identifier implied by the ``userid`` argument and
the group ids implied by the ``groupids`` argument when the
- :func:`repoze.bfg.security.authenticated_userid` or
- :func:`repoze.bfg.security.effective_principals` APIs are
+ :func:`pyramid.security.authenticated_userid` or
+ :func:`pyramid.security.effective_principals` APIs are
used.
This function is most useful when testing code that uses
- the APIs named :func:`repoze.bfg.security.has_permission`,
- :func:`repoze.bfg.security.authenticated_userid`,
- :func:`repoze.bfg.security.effective_principals`, and
- :func:`repoze.bfg.security.principals_allowed_by_permission`.
+ the APIs named :func:`pyramid.security.has_permission`,
+ :func:`pyramid.security.authenticated_userid`,
+ :func:`pyramid.security.effective_principals`, and
+ :func:`pyramid.security.principals_allowed_by_permission`.
"""
from pyramid.testing import DummySecurityPolicy
policy = DummySecurityPolicy(userid, groupids, permissive)
@@ -1887,15 +1844,15 @@ class Configurator(object):
def testing_models(self, models):
"""Unit/integration testing helper: registers a dictionary of
:term:`model` objects that can be resolved via the
- :func:`repoze.bfg.traversal.find_model` API.
+ :func:`pyramid.traversal.find_model` API.
- The :func:`repoze.bfg.traversal.find_model` API is called with
+ The :func:`pyramid.traversal.find_model` API is called with
a path as one of its arguments. If the dictionary you
register when calling this method contains that path as a
string key (e.g. ``/foo/bar`` or ``foo/bar``), the
corresponding value will be returned to ``find_model`` (and
thus to your code) when
- :func:`repoze.bfg.traversal.find_model` is called with an
+ :func:`pyramid.traversal.find_model` is called with an
equivalent path string or tuple.
"""
class DummyTraverserFactory:
@@ -1924,7 +1881,7 @@ class Configurator(object):
the list. You can then compare the values in the list to
expected event notifications. This method is useful when
testing code that wants to call
- :meth:`repoze.bfg.registry.Registry.notify`,
+ :meth:`pyramid.registry.Registry.notify`,
:func:`zope.component.event.dispatch` or
:func:`zope.component.event.objectEventNotify`.
@@ -1944,10 +1901,10 @@ class Configurator(object):
or a resource specification) and return the renderer object.
If the ``renderer`` argument is None, a 'dummy' renderer will
be used. This function is useful when testing code that calls
- the :func:`repoze.bfg.renderers.render` function or
- :func:`repoze.bfg.renderers.render_to_response` function or
+ the :func:`pyramid.renderers.render` function or
+ :func:`pyramid.renderers.render_to_response` function or
any other ``render_*`` or ``get_*`` API of the
- :mod:`repoze.bfg.renderers` module.
+ :mod:`pyramid.renderers` module.
Note that calling this method for with a ``path`` argument
representing a renderer factory type (e.g. for ``foo.pt``
@@ -1958,9 +1915,6 @@ class Configurator(object):
.. note:: This method is also available under the alias
``testing_add_template`` (an older name for it).
- .. note:: This method is new in :mod:`repoze.bfg` 1.3 (the
- method named ``testing_add_template`` had the same signature
- and purpose in previous releases)..
"""
from pyramid.testing import DummyRendererFactory
helper = RendererHelper(path, registry=self.registry)
@@ -2498,63 +2452,6 @@ def isexception(o):
(inspect.isclass(o) and (issubclass(o, Exception)))
)
-# note that ``options`` is a b/w compat alias for ``settings`` and
-# ``Configurator`` is a testing dep inj
-def make_app(root_factory, package=None, filename='configure.zcml',
- settings=None, options=None, Configurator=Configurator):
- """ Return a Router object, representing a fully configured
- :mod:`repoze.bfg` WSGI application.
-
- .. warning:: Use of this function is deprecated as of
- :mod:`repoze.bfg` 1.2. You should instead use a
- :class:`repoze.bfg.configuration.Configurator` instance to
- perform startup configuration as shown in
- :ref:`configuration_narr`.
-
- ``root_factory`` must be a callable that accepts a :term:`request`
- object and which returns a traversal root object. The traversal
- root returned by the root factory is the *default* traversal root;
- it can be overridden on a per-view basis. ``root_factory`` may be
- ``None``, in which case a 'default default' traversal root is
- used.
-
- ``package`` is a Python :term:`package` or module representing the
- application's package. It is optional, defaulting to ``None``.
- ``package`` may be ``None``. If ``package`` is ``None``, the
- ``filename`` passed or the value in the ``options`` dictionary
- named ``configure_zcml`` must be a) absolute pathname to a
- :term:`ZCML` file that represents the application's configuration
- *or* b) a :term:`resource specification` to a :term:`ZCML` file in
- the form ``dotted.package.name:relative/file/path.zcml``.
-
- ``filename`` is the filesystem path to a ZCML file (optionally
- relative to the package path) that should be parsed to create the
- application registry. It defaults to ``configure.zcml``. It can
- also be a ;term:`resource specification` in the form
- ``dotted_package_name:relative/file/path.zcml``. Note that if any
- value for ``configure_zcml`` is passed within the ``settings``
- dictionary, the value passed as ``filename`` will be ignored,
- replaced with the ``configure_zcml`` value.
-
- ``settings``, if used, should be a dictionary containing runtime
- settings (e.g. the key/value pairs in an app section of a
- PasteDeploy file), with each key representing the option and the
- key's value representing the specific option value,
- e.g. ``{'reload_templates':True}``. Note that the keyword
- parameter ``options`` is a backwards compatibility alias for the
- ``settings`` keyword parameter.
- """
- settings = settings or options or {}
- zcml_file = settings.get('configure_zcml', filename)
- config = Configurator(package=package, settings=settings,
- root_factory=root_factory)
- config.hook_zca()
- config.begin()
- config.load_zcml(zcml_file)
- config.end()
- return config.make_wsgi_app()
-
-
class DottedNameResolver(object):
""" This class resolves dotted name references to 'global' Python
objects (objects which can be imported) to those objects.
@@ -2592,7 +2489,7 @@ class DottedNameResolver(object):
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:`repoze.bfg.configuration.ConfigurationError` exception.
+ :exc:`pyramid.configuration.ConfigurationError` exception.
If a *module* or *module name* (as opposed to a package or package
name) is supplied as ``package``, its containing package is
@@ -2612,7 +2509,7 @@ class DottedNameResolver(object):
import would be for ``xml.minidom``.
When a dotted name cannot be resolved, a
- :class:`repoze.bfg.exceptions.ConfigurationError` error is raised.
+ :class:`pyramid.exceptions.ConfigurationError` error is raised.
"""
def __init__(self, package):
if package is None:
diff --git a/pyramid/events.py b/pyramid/events.py
index 9a5ff3a7b..78acce452 100644
--- a/pyramid/events.py
+++ b/pyramid/events.py
@@ -16,8 +16,8 @@ class subscriber(object):
.. code-block:: python
- from repoze.bfg.interfaces import INewRequest
- from repoze.bfg.events import subscriber
+ from pyramid.interfaces import INewRequest
+ from pyramid.events import subscriber
@subscriber(INewRequest)
def mysubscriber(event):
@@ -27,8 +27,8 @@ class subscriber(object):
.. code-block:: python
- from repoze.bfg.interfaces import INewRequest
- from repoze.bfg.events import subscriber
+ from pyramid.interfaces import INewRequest
+ from pyramid.events import subscriber
@subscriber(INewRequest, INewResponse)
def mysubscriber(event):
@@ -39,8 +39,8 @@ class subscriber(object):
.. code-block:: python
- from repoze.bfg.interfaces import INewRequest
- from repoze.bfg.events import subscriber
+ from pyramid.interfaces import INewRequest
+ from pyramid.events import subscriber
@subscriber()
def mysubscriber(event):
@@ -51,7 +51,7 @@ class subscriber(object):
.. code-block:: python
- from repoze.bfg.configuration import Configurator
+ from pyramid.configuration import Configurator
config = Configurator()
config.scan('somepackage_containing_subscribers')
@@ -71,17 +71,17 @@ class subscriber(object):
class NewRequest(object):
""" An instance of this class is emitted as an :term:`event`
- whenever :mod:`repoze.bfg` begins to process a new request. The
+ whenever :mod:`pyramid` begins to process a new request. The
even instance has an attribute, ``request``, which is a
:term:`request` object. This event class implements the
- :class:`repoze.bfg.interfaces.INewRequest` interface."""
+ :class:`pyramid.interfaces.INewRequest` interface."""
implements(INewRequest)
def __init__(self, request):
self.request = request
class NewResponse(object):
""" An instance of this class is emitted as an :term:`event`
- whenever any :mod:`repoze.bfg` :term:`view` or :term:`exception
+ whenever any :mod:`pyramid` :term:`view` or :term:`exception
view` returns a :term:`response`.
The instance has two attributes:``request``, which is the request
@@ -99,16 +99,16 @@ class NewResponse(object):
response is created under this circumstace).
This class implements the
- :class:`repoze.bfg.interfaces.INewResponse` interface.
+ :class:`pyramid.interfaces.INewResponse` interface.
.. note::
Postprocessing a response is usually better handled in a WSGI
:term:`middleware` component than in subscriber code that is
- called by a :class:`repoze.bfg.interfaces.INewResponse` event.
- The :class:`repoze.bfg.interfaces.INewResponse` event exists
+ called by a :class:`pyramid.interfaces.INewResponse` event.
+ The :class:`pyramid.interfaces.INewResponse` event exists
almost purely for symmetry with the
- :class:`repoze.bfg.interfaces.INewRequest` event.
+ :class:`pyramid.interfaces.INewRequest` event.
"""
implements(INewResponse)
def __init__(self, request, response):
@@ -117,10 +117,10 @@ class NewResponse(object):
class ContextFound(object):
""" An instance of this class is emitted as an :term:`event` after
- the :mod:`repoze.bfg` :term:`router` finds a :term:`context`
+ the :mod:`pyramid` :term:`router` finds a :term:`context`
object (after it performs traversal) but before any view code is
executed. The instance has an attribute, ``request``, which is
- the request object generated by :mod:`repoze.bfg`.
+ the request object generated by :mod:`pyramid`.
Notably, the request object will have an attribute named
``context``, which is the context that will be provided to the
@@ -128,30 +128,30 @@ class ContextFound(object):
attached by context-finding code.
This class implements the
- :class:`repoze.bfg.interfaces.IContextFound` interface.
+ :class:`pyramid.interfaces.IContextFound` interface.
- .. note:: As of :mod:`repoze.bfg` 1.3, for backwards compatibility
+ .. note:: As of :mod:`pyramid` 1.0, for backwards compatibility
purposes, this event may also be imported as
- :class:`repoze.bfg.events.AfterTraversal`.
+ :class:`pyramid.events.AfterTraversal`.
"""
implements(IContextFound)
def __init__(self, request):
self.request = request
-AfterTraversal = ContextFound # b/c as of 1.3
+AfterTraversal = ContextFound # b/c as of 1.0
class ApplicationCreated(object):
""" An instance of this class is emitted as an :term:`event` when
- the :meth:`repoze.bfg.configuration.Configurator.make_wsgi_app` is
+ the :meth:`pyramid.configuration.Configurator.make_wsgi_app` is
called. The instance has an attribute, ``app``, which is an
instance of the :term:`router` that will handle WSGI requests.
This class implements the
- :class:`repoze.bfg.interfaces.IApplicationCreated` interface.
+ :class:`pyramid.interfaces.IApplicationCreated` interface.
.. note:: For backwards compatibility purposes, this class can
also be imported as
- :class:`repoze.bfg.events.WSGIApplicationCreatedEvent`. This
- was the name of the event class before :mod:`repoze.bfg` 1.3.
+ :class:`pyramid.events.WSGIApplicationCreatedEvent`. This
+ was the name of the event class before :mod:`pyramid` 1.0.
"""
implements(IApplicationCreated)
@@ -159,5 +159,5 @@ class ApplicationCreated(object):
self.app = app
self.object = app
-WSGIApplicationCreatedEvent = ApplicationCreated # b/c (as of 1.3)
+WSGIApplicationCreatedEvent = ApplicationCreated # b/c (as of 1.0)
diff --git a/pyramid/exceptions.py b/pyramid/exceptions.py
index 785a26cee..109247c0a 100644
--- a/pyramid/exceptions.py
+++ b/pyramid/exceptions.py
@@ -77,7 +77,7 @@ class PredicateMismatch(NotFound):
class URLDecodeError(UnicodeDecodeError):
"""
- This exception is raised when :mod:`repoze.bfg` cannot
+ This exception is raised when :mod:`pyramid` cannot
successfully decode a URL or a URL path segment. This exception
it behaves just like the Python builtin
:exc:`UnicodeDecodeError`. It is a subclass of the builtin
diff --git a/pyramid/i18n.py b/pyramid/i18n.py
index d082ef6bf..718ffca79 100644
--- a/pyramid/i18n.py
+++ b/pyramid/i18n.py
@@ -20,8 +20,8 @@ class Localizer(object):
"""
An object providing translation and pluralizations related to
the current request's locale name. A
- :class:`repoze.bfg.i18n.Localizer` object is created using the
- :func:`repoze.bfg.i18n.get_localizer` function.
+ :class:`pyramid.i18n.Localizer` object is created using the
+ :func:`pyramid.i18n.get_localizer` function.
"""
def __init__(self, locale_name, translations):
self.locale_name = locale_name
@@ -48,7 +48,7 @@ class Localizer(object):
Example::
- from repoze.bfg.18n import TranslationString
+ from pyramid.18n import TranslationString
ts = TranslationString('Add ${item}', domain='mypackage',
mapping={'item':'Item'})
translated = localizer.translate(ts)
@@ -147,7 +147,7 @@ def get_locale_name(request):
return locale_name
def get_localizer(request):
- """ Retrieve a :class:`repoze.bfg.i18n.Localizer` object
+ """ Retrieve a :class:`pyramid.i18n.Localizer` object
corresponding to the current request's locale name. """
localizer = getattr(request, 'bfg_localizer', None)
diff --git a/pyramid/interfaces.py b/pyramid/interfaces.py
index d67fd2dfb..afb0376cd 100644
--- a/pyramid/interfaces.py
+++ b/pyramid/interfaces.py
@@ -4,43 +4,43 @@ from zope.interface import Interface
# public API interfaces
class IContextFound(Interface):
- """ An event type that is emitted after :mod:`repoze.bfg` finds a
+ """ An event type that is emitted after :mod:`pyramid` finds a
:term:`context` object but before it calls any view code. See the
- documentation attached to :class:`repoze.bfg.events.ContextFound`
+ documentation attached to :class:`pyramid.events.ContextFound`
for more information.
.. note:: For backwards compatibility with versions of
- :mod:`repoze.bfg` before 1.3, this event interface can also be
- imported as :class:`repoze.bfg.interfaces.IAfterTraversal`.
+ :mod:`pyramid` before 1.0, this event interface can also be
+ imported as :class:`pyramid.interfaces.IAfterTraversal`.
"""
request = Attribute('The request object')
IAfterTraversal = IContextFound
class INewRequest(Interface):
- """ An event type that is emitted whenever :mod:`repoze.bfg`
+ """ An event type that is emitted whenever :mod:`pyramid`
begins to process a new request. See the documentation attached
- to :class:`repoze.bfg.events.NewRequest` for more information."""
+ to :class:`pyramid.events.NewRequest` for more information."""
request = Attribute('The request object')
class INewResponse(Interface):
- """ An event type that is emitted whenever any :mod:`repoze.bfg`
+ """ An event type that is emitted whenever any :mod:`pyramid`
view returns a response. See the
- documentation attached to :class:`repoze.bfg.events.NewResponse`
+ documentation attached to :class:`pyramid.events.NewResponse`
for more information."""
request = Attribute('The request object')
response = Attribute('The response object')
class IApplicationCreated(Interface):
""" Event issued when the
- :meth:`repoze.bfg.configuration.Configurator.make_wsgi_app` method
+ :meth:`pyramid.configuration.Configurator.make_wsgi_app` method
is called. See the documentation attached to
- :class:`repoze.bfg.events.ApplicationCreated` for more
+ :class:`pyramid.events.ApplicationCreated` for more
information.
- .. note:: For backwards compatibility with :mod:`repoze.bfg`
- versions before 1.3, this interface can also be imported as
- :class:`repoze.bfg.interfaces.IWSGIApplicationCreatedEvent`.
+ .. note:: For backwards compatibility with :mod:`pyramid`
+ versions before 1.0, this interface can also be imported as
+ :class:`pyramid.interfaces.IWSGIApplicationCreatedEvent`.
"""
app = Attribute(u"Created application")
@@ -58,9 +58,9 @@ class IExceptionResponse(IException, IResponse):
""" An interface representing a WSGI response which is also an
exception object. Register an exception view using this interface
as a ``context`` to apply the registered view for all exception
- types raised by :mod:`repoze.bfg` internally
- (:class:`repoze.bfg.exceptions.NotFound` and
- :class:`repoze.bfg.exceptions.Forbidden`)."""
+ types raised by :mod:`pyramid` internally
+ (:class:`pyramid.exceptions.NotFound` and
+ :class:`pyramid.exceptions.Forbidden`)."""
# internal interfaces
@@ -74,7 +74,7 @@ class IRouteRequest(Interface):
route-specific interfaces. Not an API."""
class IAuthenticationPolicy(Interface):
- """ An object representing a BFG authentication policy. """
+ """ An object representing a Pyramid authentication policy. """
def authenticated_userid(request):
""" Return the authenticated userid or ``None`` if no
authenticated userid can be found. """
@@ -96,7 +96,7 @@ class IAuthenticationPolicy(Interface):
current user on subsequent requests. """
class IAuthorizationPolicy(Interface):
- """ An object representing a BFG authorization policy. """
+ """ An object representing a Pyramid authorization policy. """
def permits(context, principals, permission):
""" Return True if any of the principals is allowed the
permission in the current context, else return False """
@@ -124,7 +124,7 @@ class IRequestFactory(Interface):
""" A utility which generates a request """
def __call__(environ):
""" Return an object implementing IRequest, e.g. an instance
- of ``repoze.bfg.request.Request``"""
+ of ``pyramid.request.Request``"""
def blank(path):
""" Return an empty request object (see
@@ -139,9 +139,9 @@ class IExceptionViewClassifier(Interface):
class IView(Interface):
def __call__(context, request):
""" Must return an object that implements IResponse. May
- optionally raise ``repoze.bfg.exceptions.Forbidden`` if an
+ optionally raise ``pyramid.exceptions.Forbidden`` if an
authorization failure is detected during view execution or
- ``repoze.bfg.exceptions.NotFound`` if the not found page is
+ ``pyramid.exceptions.NotFound`` if the not found page is
meant to be returned."""
class ISecuredView(IView):
@@ -239,12 +239,12 @@ class IRouter(Interface):
"""Component architecture registry local to this application.""")
class ISettings(Interface):
- """ Runtime settings utility for repoze.bfg; represents the
+ """ Runtime settings utility for pyramid; represents the
deployment settings for the application. Implements a mapping
interface."""
-# this interface, even if it becomes unused within BFG, is imported by
-# other packages (such as repoze.bfg.traversalwrapper)
+# this interface, even if it becomes unused within Pyramid, is
+# imported by other packages (such as repoze.bfg.traversalwrapper)
class ILocation(Interface):
"""Objects that have a structural location"""
__parent__ = Attribute("The parent in the location hierarchy")
@@ -259,7 +259,7 @@ class IRoutePregenerator(Interface):
def __call__(request, elements, kw):
""" A pregenerator is a function associated by a developer
with a :term:`route`. The pregenerator for a route is called
- by :func:`repoze.bfg.url.route_url` in order to adjust the set
+ by :func:`pyramid.url.route_url` in order to adjust the set
of arguments passed to it by the user for special purposes,
such as Pylons 'subdomain' support. It will influence the URL
returned by ``route_url``.
@@ -274,10 +274,9 @@ class IRoutePregenerator(Interface):
You can employ a pregenerator by passing a ``pregenerator``
argument to the
- :meth:`repoze.bfg.configuration.Configurator.add_route`
+ :meth:`pyramid.configuration.Configurator.add_route`
function.
- .. note:: This interface is new as of :mod:`repoze.bfg` 1.3.
"""
class IRoute(Interface):
@@ -286,7 +285,7 @@ class IRoute(Interface):
name = Attribute('The route name')
pattern = Attribute('The route pattern')
factory = Attribute(
- 'The :term:`root factory` used by the :mod:`repoze.bfg` router '
+ 'The :term:`root factory` used by the :mod:`pyramid` router '
'when this route matches (or ``None``)')
predicates = Attribute(
'A sequence of :term:`route predicate` objects used to '
diff --git a/pyramid/log.py b/pyramid/log.py
index b8762e6e2..8a29ca919 100644
--- a/pyramid/log.py
+++ b/pyramid/log.py
@@ -3,7 +3,7 @@ import logging
def make_stream_logger(
name, stream, levelname='DEBUG', fmt='%(asctime)s %(message)s'):
""" Return an object which implements
- ``repoze.bfg.interfaces.IDebugLogger`` (ie. a Python PEP 282 logger
+ ``pyramid.interfaces.IDebugLogger`` (ie. a Python PEP 282 logger
instance) with the name ``name`` using the stream (or open
filehandle) ``stream``, logging at ``levelname`` log level or
above with format ``fmt``. """
diff --git a/pyramid/paster.py b/pyramid/paster.py
index e84cd42d9..0b7a4f7c7 100644
--- a/pyramid/paster.py
+++ b/pyramid/paster.py
@@ -12,22 +12,22 @@ from pyramid.scripting import get_root
class StarterProjectTemplate(Template):
_template_dir = 'paster_templates/starter'
- summary = 'repoze.bfg starter project'
+ summary = 'pyramid starter project'
template_renderer = staticmethod(paste_script_template_renderer)
class ZODBProjectTemplate(Template):
_template_dir = 'paster_templates/zodb'
- summary = 'repoze.bfg ZODB starter project'
+ summary = 'pyramid ZODB starter project'
template_renderer = staticmethod(paste_script_template_renderer)
class RoutesAlchemyProjectTemplate(Template):
_template_dir = 'paster_templates/routesalchemy'
- summary = 'repoze.bfg SQLAlchemy project using Routes (no traversal)'
+ summary = 'pyramid SQLAlchemy project using Routes (no traversal)'
template_renderer = staticmethod(paste_script_template_renderer)
class AlchemyProjectTemplate(Template):
_template_dir = 'paster_templates/alchemy'
- summary = 'repoze.bfg SQLAlchemy project using traversal'
+ summary = 'pyramid SQLAlchemy project using traversal'
template_renderer = staticmethod(paste_script_template_renderer)
def get_app(config_file, name, loadapp=loadapp):
@@ -40,7 +40,7 @@ def get_app(config_file, name, loadapp=loadapp):
_marker = object()
class BFGShellCommand(Command):
- """Open an interactive shell with a :mod:`repoze.bfg` app loaded.
+ """Open an interactive shell with a :mod:`pyramid` app loaded.
This command accepts two positional arguments:
@@ -60,7 +60,7 @@ class BFGShellCommand(Command):
command will almost certainly fail.
"""
- summary = "Open an interactive shell with a repoze.bfg app loaded"
+ summary = "Open an interactive shell with a pyramid app loaded"
min_args = 2
max_args = 2
diff --git a/pyramid/renderers.py b/pyramid/renderers.py
index a1b3196c4..251242916 100644
--- a/pyramid/renderers.py
+++ b/pyramid/renderers.py
@@ -53,8 +53,6 @@ def render(renderer_name, value, request=None, package=None):
with the most correct 'system' values (``request`` and ``context``
in particular).
- .. note:: This API is new in :mod:`repoze.bfg` 1.3.
-
"""
try:
registry = request.registry
@@ -97,8 +95,6 @@ def render_to_response(renderer_name, value, request=None, package=None):
with the most correct 'system' values (``request`` and ``context``
in particular).
- .. note:: This API is new in :mod:`repoze.bfg` 1.3.
-
"""
try:
registry = request.registry
@@ -219,9 +215,9 @@ def rendered_response(renderer, result, view, context, request, renderer_name):
return helper.render_to_response(result, system, request=request)
deprecated('rendered_response',
- "('repoze.bfg.renderers.rendered_response' is not a public API; it is "
- "officially deprecated as of repoze.bfg 1.3; "
- "use repoze.bfg.renderers.render_to_response instead')",
+ "('pyramid.renderers.rendered_response' is not a public API; it is "
+ "officially deprecated as of pyramid 1.0; "
+ "use pyramid.renderers.render_to_response instead')",
)
class RendererHelper(object):
diff --git a/pyramid/request.py b/pyramid/request.py
index 04ce1acd7..7932cda20 100644
--- a/pyramid/request.py
+++ b/pyramid/request.py
@@ -1,4 +1,3 @@
-from zope.deprecation import deprecated
from zope.interface import implements
from zope.interface.interface import InterfaceClass
@@ -25,7 +24,7 @@ class Request(WebobRequest):
Due to technical constraints, we can't yet display the WebOb
version number from which this documentation is autogenerated, but
it will be the 'prevailing WebOb version' at the time of the
- release of this :mod:`repoze.bfg` version. See
+ release of this :mod:`pyramid` version. See
http://http://pythonpaste.org/webob/ for further information.
"""
implements(IRequest)
@@ -37,7 +36,7 @@ class Request(WebobRequest):
"""
Add a callback to the set of callbacks to be called by the
:term:`router` at a point after a :term:`response` object is
- successfully created. :mod:`repoze.bfg` does not have a
+ successfully created. :mod:`pyramid` does not have a
global response object: this functionality allows an
application to register an action to be performed against the
response once one is created.
@@ -59,15 +58,12 @@ class Request(WebobRequest):
response object returned by :term:`view` code is invalid.
All response callbacks are called *after* the
- :class:`repoze.bfg.interfaces.INewResponse` event is sent.
+ :class:`pyramid.interfaces.INewResponse` event is sent.
Errors raised by callbacks are not handled specially. They
- will be propagated to the caller of the :mod:`repoze.bfg`
+ will be propagated to the caller of the :mod:`pyramid`
router application.
- .. note: ``add_response_callback`` is new in :mod:`repoze.bfg`
- 1.3.
-
See also: :ref:`using_response_callbacks`.
"""
@@ -123,12 +119,9 @@ class Request(WebobRequest):
immediately after all finished callbacks have been processed.
Errors raised by finished callbacks are not handled specially.
- They will be propagated to the caller of the :mod:`repoze.bfg`
+ They will be propagated to the caller of the :mod:`pyramid`
router application.
- .. note: ``add_finished_callback`` is new in :mod:`repoze.bfg`
- 1.3.
-
See also: :ref:`using_finished_callbacks`.
"""
@@ -217,13 +210,3 @@ def add_global_response_headers(request, headerlist):
response.headerlist.append((k, v))
request.add_response_callback(add_headers)
-from pyramid.threadlocal import get_current_request as get_request # b/c
-
-get_request # prevent PyFlakes complaints
-
-deprecated('get_request',
- 'As of repoze.bfg 1.0, any import of get_request from'
- '``repoze.bfg.request`` is '
- 'deprecated. Use ``from repoze.bfg.threadlocal import '
- 'get_current_request instead.')
-
diff --git a/pyramid/router.py b/pyramid/router.py
index d140f8225..3ec23c3e4 100644
--- a/pyramid/router.py
+++ b/pyramid/router.py
@@ -14,7 +14,6 @@ from pyramid.interfaces import ITraverser
from pyramid.interfaces import IView
from pyramid.interfaces import IViewClassifier
-from pyramid.configuration import make_app # b/c import
from pyramid.events import ContextFound
from pyramid.events import NewRequest
from pyramid.events import NewResponse
@@ -24,8 +23,6 @@ from pyramid.threadlocal import manager
from pyramid.traversal import DefaultRootFactory
from pyramid.traversal import ModelGraphTraverser
-make_app # prevent pyflakes from complaining
-
class Router(object):
implements(IRouter)
@@ -47,7 +44,7 @@ class Router(object):
def __call__(self, environ, start_response):
"""
Accept ``environ`` and ``start_response``; create a
- :term:`request` and route the request to a :mod:`repoze.bfg`
+ :term:`request` and route the request to a :mod:`pyramid`
view based on introspection of :term:`view configuration`
within the application registry; call ``start_response`` and
return an iterable.
diff --git a/pyramid/scripting.py b/pyramid/scripting.py
index 4ef6799a7..2f989cc7d 100644
--- a/pyramid/scripting.py
+++ b/pyramid/scripting.py
@@ -8,7 +8,7 @@ def get_root(app, request=None):
is a callable (accepting no arguments) that should be called when
your scripting application is finished using the root. If
``request`` is not None, it is used as the request passed to the
- :mod:`repoze.bfg` application root factory. A request is
+ :mod:`pyramid` application root factory. A request is
constructed and passed to the root factory if ``request`` is None."""
registry = app.registry
if request is None:
diff --git a/pyramid/security.py b/pyramid/security.py
index 8f896c7a0..02e02746d 100644
--- a/pyramid/security.py
+++ b/pyramid/security.py
@@ -1,23 +1,12 @@
from zope.interface import providedBy
-from zope.deprecation import deprecated
-
from pyramid.interfaces import IAuthenticationPolicy
from pyramid.interfaces import IAuthorizationPolicy
from pyramid.interfaces import ISecuredView
from pyramid.interfaces import IViewClassifier
-from pyramid.exceptions import Forbidden as Unauthorized # b/c import
from pyramid.threadlocal import get_current_registry
-Unauthorized # prevent PyFlakes from complaining
-
-deprecated('Unauthorized',
- "('from repoze.bfg.security import Unauthorized' was "
- "deprecated as of repoze.bfg 1.1; instead use 'from "
- "repoze.bfg.exceptions import Forbidden')",
- )
-
Everyone = 'system.Everyone'
Authenticated = 'system.Authenticated'
Allow = 'Allow'
@@ -38,13 +27,13 @@ DENY_ALL = (Deny, Everyone, ALL_PERMISSIONS)
def has_permission(permission, context, request):
""" Provided a permission (a string or unicode object), a context
(a :term:`model` instance) and a request object, return an
- instance of :data:`repoze.bfg.security.Allowed` if the permission
+ instance of :data:`pyramid.security.Allowed` if the permission
is granted in this context to the user implied by the
- request. Return an instance of :mod:`repoze.bfg.security.Denied`
+ request. Return an instance of :mod:`pyramid.security.Denied`
if this permission is not granted in this context to this user.
This function delegates to the current authentication and
authorization policies. Return
- :data:`repoze.bfg.security.Allowed` unconditionally if no
+ :data:`pyramid.security.Allowed` unconditionally if no
authentication policy has been configured in this application."""
try:
reg = request.registry
@@ -97,7 +86,7 @@ def principals_allowed_by_permission(context, permission):
in effect, return a sequence of :term:`principal` ids that possess
the permission in the ``context``. If no authorization policy is
in effect, this will return a sequence with the single value
- :mod:`repoze.bfg.security.Everyone` (the special principal
+ :mod:`pyramid.security.Everyone` (the special principal
identifier representing all principals).
.. note:: even if an :term:`authorization policy` is in effect,
@@ -140,7 +129,7 @@ def remember(request, principal, **kw):
assumed to be an :term:`WebOb` -style :term:`response` object
computed previously by the view code)::
- from repoze.bfg.security import remember
+ from pyramid.security import remember
headers = remember(request, 'chrism', password='123', max_age='86400')
response.headerlist.extend(headers)
return response
@@ -167,7 +156,7 @@ def forget(request):
(``response`` is assumed to be an :term:`WebOb` -style
:term:`response` object computed previously by the view code)::
- from repoze.bfg.security import forget
+ from pyramid.security import forget
headers = forget(request)
response.headerlist.extend(headers)
return response
@@ -205,7 +194,7 @@ class PermitsResult(int):
class Denied(PermitsResult):
""" An instance of ``Denied`` is returned when a security-related
- API or other :mod:`repoze.bfg` code denies an action unrelated to
+ API or other :mod:`pyramid` code denies an action unrelated to
an ACL check. It evaluates equal to all boolean false types. It
has an attribute named ``msg`` describing the circumstances for
the deny."""
@@ -213,7 +202,7 @@ class Denied(PermitsResult):
class Allowed(PermitsResult):
""" An instance of ``Allowed`` is returned when a security-related
- API or other :mod:`repoze.bfg` code allows an action unrelated to
+ API or other :mod:`pyramid` code allows an action unrelated to
an ACL check. It evaluates equal to all boolean true types. It
has an attribute named ``msg`` describing the circumstances for
the allow."""
diff --git a/pyramid/settings.py b/pyramid/settings.py
index 129bea36c..d4e54a38e 100644
--- a/pyramid/settings.py
+++ b/pyramid/settings.py
@@ -66,14 +66,14 @@ def get_settings():
Return a 'settings' object for the current application. A
'settings' object is a dictionary-like object that contains
key/value pairs based on the dictionary passed as the ``settings``
- argument to the :class:`repoze.bfg.configuration.Configurator`
- constructor or the :func:`repoze.bfg.router.make_app` API.
+ argument to the :class:`pyramid.configuration.Configurator`
+ constructor or the :func:`pyramid.router.make_app` API.
.. note:: For backwards compatibility, dictionary keys can also be
looked up as attributes of the settings object.
.. note:: the
- :class:`repoze.bfg.configuration.Configurator.get_settings` method
+ :class:`pyramid.configuration.Configurator.get_settings` method
performs the same duty.
"""
reg = get_current_registry()
diff --git a/pyramid/static.py b/pyramid/static.py
index 871f6f50c..00102561d 100644
--- a/pyramid/static.py
+++ b/pyramid/static.py
@@ -152,7 +152,7 @@ class StaticURLInfo(object):
class static_view(object):
""" An instance of this class is a callable which can act as a
- :mod:`repoze.bfg` :term:`view callable`; this view will serve
+ :mod:`pyramid` :term:`view callable`; this view will serve
static files from a directory on disk based on the ``root_dir``
you provide to its constructor.
@@ -179,9 +179,9 @@ class static_view(object):
five minutes).
.. note:: If the ``root_dir`` is relative to a :term:`package`, or
- is a :term:`resource specification` the :mod:`repoze.bfg`
+ is a :term:`resource specification` the :mod:`pyramid`
``resource`` ZCML directive or
- :class:`repoze.bfg.configuration.Configurator` method can be
+ :class:`pyramid.configuration.Configurator` method can be
used to override resources within the named ``root_dir``
package-relative directory. However, if the ``root_dir`` is
absolute, the ``resource`` directive will not be able to
diff --git a/pyramid/testing.py b/pyramid/testing.py
index c6695e07b..5d54af9e9 100644
--- a/pyramid/testing.py
+++ b/pyramid/testing.py
@@ -28,7 +28,7 @@ zcml_configure # prevent pyflakes from complaining
_marker = object()
def registerDummySecurityPolicy(userid=None, groupids=(), permissive=True):
- """ Registers a pair of faux :mod:`repoze.bfg` security policies:
+ """ Registers a pair of faux :mod:`pyramid` security policies:
a :term:`authentication policy` and a :term:`authorization
policy`.
@@ -44,16 +44,16 @@ def registerDummySecurityPolicy(userid=None, groupids=(), permissive=True):
argument. The authentication policy will return the userid
identifier implied by the ``userid`` argument and the group ids
implied by the ``groupids`` argument when the
- :func:`repoze.bfg.security.authenticated_userid` or
- :func:`repoze.bfg.security.effective_principals` APIs are used.
+ :func:`pyramid.security.authenticated_userid` or
+ :func:`pyramid.security.effective_principals` APIs are used.
This function is most useful when testing code that uses the APIs
- named :func:`repoze.bfg.security.has_permission`,
- :func:`repoze.bfg.security.authenticated_userid`,
- :func:`repoze.bfg.security.effective_principals`, and
- :func:`repoze.bfg.security.principals_allowed_by_permission`.
+ named :func:`pyramid.security.has_permission`,
+ :func:`pyramid.security.authenticated_userid`,
+ :func:`pyramid.security.effective_principals`, and
+ :func:`pyramid.security.principals_allowed_by_permission`.
- .. warning:: This API is deprecated as of :mod:`repoze.bfg` 1.2.
+ .. warning:: This API is deprecated as of :mod:`pyramid` 1.0.
Instead use the
:meth:`repoze.bfg.configuration.Configurator.testing_securitypolicy`
method in your unit and integration tests.
@@ -65,19 +65,19 @@ def registerDummySecurityPolicy(userid=None, groupids=(), permissive=True):
def registerModels(models):
""" Registers a dictionary of :term:`model` objects that can be
- resolved via the :func:`repoze.bfg.traversal.find_model` API.
+ resolved via the :func:`pyramid.traversal.find_model` API.
- The :func:`repoze.bfg.traversal.find_model` API is called with a
+ The :func:`pyramid.traversal.find_model` API is called with a
path as one of its arguments. If the dictionary you register when
calling this method contains that path as a string key
(e.g. ``/foo/bar`` or ``foo/bar``), the corresponding value will
be returned to ``find_model`` (and thus to your code) when
- :func:`repoze.bfg.traversal.find_model` is called with an
+ :func:`pyramid.traversal.find_model` is called with an
equivalent path string or tuple.
- .. warning:: This API is deprecated as of :mod:`repoze.bfg` 1.2.
+ .. warning:: This API is deprecated as of :mod:`pyramid` 1.0.
Instead use the
- :meth:`repoze.bfg.configuration.Configurator.testing_models`
+ :meth:`pyramid.configuration.Configurator.testing_models`
method in your unit and integration tests.
"""
registry = get_current_registry()
@@ -94,16 +94,16 @@ def registerEventListener(event_iface=None):
event will be appended to the list. You can then compare the
values in the list to expected event notifications. This method
is useful when testing code that wants to call
- :meth:`repoze.bfg.registry.Registry.notify`,
+ :meth:`pyramid.registry.Registry.notify`,
:func:`zope.component.event.dispatch` or
:func:`zope.component.event.objectEventNotify`.
The default value of ``event_iface`` (``None``) implies a
subscriber registered for *any* kind of event.
- .. warning:: This API is deprecated as of :mod:`repoze.bfg` 1.2.
+ .. warning:: This API is deprecated as of :mod:`pyramid` 1.0.
Instead use the
- :meth:`repoze.bfg.configuration.Configurator.testing_add_subscriber`
+ :meth:`pyramid.configuration.Configurator.testing_add_subscriber`
method in your unit and integration tests.
"""
registry = get_current_registry()
@@ -115,14 +115,14 @@ def registerTemplateRenderer(path, renderer=None):
filename ala ``templates/foo.pt``) and return the renderer object.
If the ``renderer`` argument is None, a 'dummy' renderer will be
used. This function is useful when testing code that calls the
- :func:`repoze.bfg.renderers.render` function or
- :func:`repoze.bfg.renderers.render_to_response` function or any
+ :func:`pyramid.renderers.render` function or
+ :func:`pyramid.renderers.render_to_response` function or any
other ``render_*`` or ``get_*`` API of the
- :mod:`repoze.bfg.renderers` module.
+ :mod:`pyramid.renderers` module.
- .. warning:: This API is deprecated as of :mod:`repoze.bfg` 1.2.
+ .. warning:: This API is deprecated as of :mod:`pyramid` 1.0.
Instead use the
- :meth:`repoze.bfg.configuration.Configurator.testing_add_template``
+ :meth:`pyramid.configuration.Configurator.testing_add_template``
method in your unit and integration tests.
"""
@@ -136,7 +136,7 @@ registerDummyRenderer = registerTemplateRenderer
def registerView(name, result='', view=None, for_=(Interface, Interface),
permission=None):
- """ Registers a :mod:`repoze.bfg` :term:`view callable` under the
+ """ Registers a :mod:`pyramid` :term:`view callable` under the
name implied by the ``name`` argument. The view will return a
:term:`WebOb` :term:`Response` object with the value implied by
the ``result`` argument as its ``body`` attribute. To gain more
@@ -150,11 +150,11 @@ def registerView(name, result='', view=None, for_=(Interface, Interface),
execution is attempted.
This function is useful when testing code which calls
- :func:`repoze.bfg.view.render_view_to_response`.
+ :func:`pyramid.view.render_view_to_response`.
- .. warning:: This API is deprecated as of :mod:`repoze.bfg` 1.2.
+ .. warning:: This API is deprecated as of :mod:`pyramid` 1.0.
Instead use the
- :meth:`repoze.bfg.configuration.Configurator.add_view``
+ :meth:`pyramid.configuration.Configurator.add_view``
method in your unit and integration tests.
"""
for_ = (IViewClassifier, ) + for_
@@ -188,11 +188,11 @@ def registerUtility(impl, iface=Interface, name=''):
See `The ZCA book <http://www.muthukadan.net/docs/zca.html>`_ for
more information about ZCA utilities.
- .. warning:: This API is deprecated as of :mod:`repoze.bfg` 1.2.
- Instead use the :meth:`repoze.bfg.Registry.registerUtility`
+ .. warning:: This API is deprecated as of :mod:`pyramid` 1.0.
+ Instead use the :meth:`pyramid.Registry.registerUtility`
method. The ``registry`` attribute of a :term:`Configurator`
in your unit and integration tests is an instance of the
- :class:`repoze.bfg.Registry` class.
+ :class:`pyramid.Registry` class.
"""
reg = get_current_registry()
reg.registerUtility(impl, iface, name=name)
@@ -206,7 +206,7 @@ def registerAdapter(impl, for_=Interface, provides=Interface, name=''):
``for`` interface type used for this registration; it is
:class:`zope.interface.Interface` by default. If ``for`` is not a
tuple or list, it will be converted to a one-tuple before being
- passed to underlying :meth:`repoze.bfg.registry.registerAdapter`
+ passed to underlying :meth:`pyramid.registry.registerAdapter`
API.
The ``provides`` argument specifies the ZCA 'provides' interface,
@@ -218,11 +218,11 @@ def registerAdapter(impl, for_=Interface, provides=Interface, name=''):
See `The ZCA book <http://www.muthukadan.net/docs/zca.html>`_ for
more information about ZCA adapters.
- .. warning:: This API is deprecated as of :mod:`repoze.bfg` 1.2.
- Instead use the :meth:`repoze.bfg.Registry.registerAdapter`
+ .. warning:: This API is deprecated as of :mod:`pyramid` 1.0.
+ Instead use the :meth:`pyramid.Registry.registerAdapter`
method. The ``registry`` attribute of a :term:`Configurator`
in your unit and integration tests is an instance of the
- :class:`repoze.bfg.Registry` class.
+ :class:`pyramid.Registry` class.
"""
reg = get_current_registry()
if not isinstance(for_, (tuple, list)):
@@ -240,14 +240,14 @@ def registerSubscriber(subscriber, iface=Interface):
subscriber will be registered (:class:`zope.interface.Interface`
by default). If ``iface`` is not a tuple or list, it will be
converted to a one-tuple before being passed to the underlying ZCA
- :meth:`repoze.bfg.registry.registerHandler` method.
+ :meth:`pyramid.registry.registerHandler` method.
See `The ZCA book <http://www.muthukadan.net/docs/zca.html>`_ for
more information about ZCA subscribers.
- .. warning:: This API is deprecated as of :mod:`repoze.bfg` 1.2.
+ .. warning:: This API is deprecated as of :mod:`pyramid` 1.0.
Instead use the
- :meth:`repoze.bfg.configuration.Configurator.add_subscriber`
+ :meth:`pyramid.configuration.Configurator.add_subscriber`
method in your unit and integration tests.
"""
registry = get_current_registry()
@@ -264,13 +264,11 @@ def registerRoute(pattern, name, factory=None):
a :term:`root factory` associated with the route.
This API is useful for testing code that calls
- e.g. :func:`repoze.bfg.url.route_url`.
+ e.g. :func:`pyramid.url.route_url`.
- .. note:: This API was added in :mod:`repoze.bfg` version 1.1.
-
- .. warning:: This API is deprecated as of :mod:`repoze.bfg` 1.2.
+ .. warning:: This API is deprecated as of :mod:`pyramid` 1.0.
Instead use the
- :meth:`repoze.bfg.configuration.Configurator.add_route`
+ :meth:`pyramid.configuration.Configurator.add_route`
method in your unit and integration tests.
"""
reg = get_current_registry()
@@ -280,7 +278,7 @@ def registerRoute(pattern, name, factory=None):
def registerSettings(dictarg=None, **kw):
"""Register one or more 'setting' key/value pairs. A setting is
a single key/value pair in the dictionary-ish object returned from
- the API :func:`repoze.bfg.settings.get_settings`.
+ the API :func:`pyramid.settings.get_settings`.
You may pass a dictionary::
@@ -291,14 +289,12 @@ def registerSettings(dictarg=None, **kw):
registerSettings(external_uri='http://example.com')
Use of this function is required when you need to test code that
- calls the :func:`repoze.bfg.settings.get_settings` API and which
+ calls the :func:`pyramid.settings.get_settings` API and which
uses return values from that API.
- .. note:: This API is new as of :mod:`repoze.bfg` 1.1.
-
- .. warning:: This API is deprecated as of :mod:`repoze.bfg` 1.2.
+ .. warning:: This API is deprecated as of :mod:`pyramid` 1.0.
Instead use the
- :meth:`repoze.bfg.configuration.Configurator.add_settings`
+ :meth:`pyramid.configuration.Configurator.add_settings`
method in your unit and integration tests.
"""
registry = get_current_registry()
@@ -345,7 +341,7 @@ class DummySecurityPolicy(object):
class DummyTemplateRenderer(object):
"""
An instance of this class is returned from
- :func:`repoze.bfg.testing.registerTemplateRenderer`. It has a
+ :func:`pyramid.testing.registerTemplateRenderer`. It has a
helper function (``assert_``) that makes it possible to make an
assertion which compares data passed to the renderer by the view
function against expected key/value pairs.
@@ -387,7 +383,7 @@ class DummyTemplateRenderer(object):
def assert_(self, **kw):
""" Accept an arbitrary set of assertion key/value pairs. For
each assertion key/value pair assert that the renderer
- (eg. :func:`repoze.bfg.renderer.render_to_response`)
+ (eg. :func:`pyramid.renderer.render_to_response`)
received the key with a value that equals the asserted
value. If the renderer did not receive the key at all, or the
value received by the renderer doesn't match the assertion
@@ -408,7 +404,7 @@ class DummyTemplateRenderer(object):
return True
class DummyModel:
- """ A dummy :mod:`repoze.bfg` :term:`model` object."""
+ """ A dummy :mod:`pyramid` :term:`model` object."""
def __init__(self, __name__=None, __parent__=None, __provides__=None,
**kw):
""" The model's ``__name__`` attribute will be set to the
@@ -558,50 +554,44 @@ class DummyRequest(object):
def setUp(registry=None, request=None, hook_zca=True):
"""
- Set :mod:`repoze.bfg` registry and request thread locals for the
+ Set :mod:`pyramid` registry and request thread locals for the
duration of a single unit test.
- .. note:: The ``setUp`` function is new as of :mod:`repoze.bfg`
- 1.1.
-
Use this function in the ``setUp`` method of a unittest test case
which directly or indirectly uses:
- - any of the ``register*`` functions in :mod:`repoze.bfg.testing`
- (such as :func:`repoze.bfg.testing.registerModels`)
+ - any of the ``register*`` functions in :mod:`pyramid.testing`
+ (such as :func:`pyramid.testing.registerModels`)
- - any method of the :class:`repoze.bfg.configuration.Configurator`
+ - any method of the :class:`pyramid.configuration.Configurator`
object returned by this function.
- - the :func:`repoze.bfg.threadlocal.get_current_registry` or
- :func:`repoze.bfg.threadlocal.get_current_request` functions.
+ - the :func:`pyramid.threadlocal.get_current_registry` or
+ :func:`pyramid.threadlocal.get_current_request` functions.
If you use the ``testing.register*`` APIs, or the
- ``get_current_*`` functions (or call :mod:`repoze.bfg` code that
+ ``get_current_*`` functions (or call :mod:`pyramid` code that
uses these functions) without calling ``setUp``,
- :func:`repoze.bfg.threadlocal.get_current_registry` will return a
+ :func:`pyramid.threadlocal.get_current_registry` will return a
*global* :term:`application registry`, which may cause unit tests
to not be isolated with respect to registrations they perform.
If the ``registry`` argument is ``None``, a new empty
:term:`application registry` will be created (an instance of the
- :class:`repoze.bfg.registry.Registry` class). If the ``registry``
+ :class:`pyramid.registry.Registry` class). If the ``registry``
argument is not ``None``, the value passed in should be an
- instance of the :class:`repoze.bfg.registry.Registry` class or a
+ instance of the :class:`pyramid.registry.Registry` class or a
suitable testing analogue.
After ``setUp`` is finished, the registry returned by the
- :func:`repoze.bfg.threadlocal.get_current_request` function will
+ :func:`pyramid.threadlocal.get_current_request` function will
be the passed (or constructed) registry until
- :func:`repoze.bfg.testing.tearDown` is called (or
- :func:`repoze.bfg.testing.setUp` is called again) .
-
- .. note:: The ``registry`` argument is new as of :mod:`repoze.bfg`
- 1.2.
+ :func:`pyramid.testing.tearDown` is called (or
+ :func:`pyramid.testing.setUp` is called again) .
If the ``hook_zca`` argument is ``True``, ``setUp`` will attempt
to perform the operation ``zope.component.getSiteManager.sethook(
- repoze.bfg.threadlocal.get_current_registry)``, which will cause
+ pyramid.threadlocal.get_current_registry)``, which will cause
the :term:`Zope Component Architecture` global API
(e.g. :func:`zope.component.getSiteManager`,
:func:`zope.component.getAdapter`, and so on) to use the registry
@@ -611,27 +601,20 @@ def setUp(registry=None, request=None, hook_zca=True):
``hook_zca`` is ``False``, the hook will not be set.
This function returns an instance of the
- :class:`repoze.bfg.configuration.Configurator` class, which can be
+ :class:`pyramid.configuration.Configurator` class, which can be
used for further configuration to set up an environment suitable
for a unit or integration test. The ``registry`` attribute
attached to the Configurator instance represents the 'current'
:term:`application registry`; the same registry will be returned
- by :func:`repoze.bfg.threadlocal.get_current_registry` during the
+ by :func:`pyramid.threadlocal.get_current_registry` during the
execution of the test.
- .. note:: The ``hook_zca`` argument is new as of :mod:`repoze.bfg`
- 1.2.
-
- .. note:: The return value (a ``Configurator`` instance) is new as
- of :mod:`repoze.bfg` 1.2 (previous versions used to return
- ``None``)
-
.. warning:: Although this method of setting up a test registry
- will never disappear, after :mod:`repoze.bfg` 1.2a6,
+ will never disappear, after :mod:`pyramid` 1.0,
using the ``begin`` and ``end`` methods of a
``Configurator`` are preferred to using
- ``repoze.bfg.testing.setUp`` and
- ``repoze.bfg.testing.tearDown``. See
+ ``pyramid.testing.setUp`` and
+ ``pyramid.testing.tearDown``. See
:ref:`unittesting_chapter` for more information.
"""
manager.clear()
@@ -648,11 +631,11 @@ def setUp(registry=None, request=None, hook_zca=True):
for name, renderer in DEFAULT_RENDERERS:
# Cause the default renderers to be registered because
# in-the-wild test code relies on being able to call
- # e.g. ``repoze.bfg.chameleon_zpt.render_template``
+ # e.g. ``pyramid.chameleon_zpt.render_template``
# without registering a .pt renderer, expecting the "real"
# template to be rendered. This is a holdover from when
# individual template system renderers weren't indirected
- # by the ``repoze.bfg.renderers`` machinery, and
+ # by the ``pyramid.renderers`` machinery, and
# ``render_template`` and friends went behind the back of
# any existing renderer factory lookup system.
config.add_renderer(name, renderer)
@@ -661,27 +644,22 @@ def setUp(registry=None, request=None, hook_zca=True):
return config
def tearDown(unhook_zca=True):
- """Undo the effects :func:`repoze.bfg.testing.setUp`. Use this
+ """Undo the effects :func:`pyramid.testing.setUp`. Use this
function in the ``tearDown`` method of a unit test that uses
- :func:`repoze.bfg.testing.setUp` in its ``setUp`` method.
-
- .. note:: This function is new as of :mod:`repoze.bfg` 1.1.
+ :func:`pyramid.testing.setUp` in its ``setUp`` method.
If the ``unhook_zca`` argument is ``True`` (the default), call
:func:`zope.component.getSiteManager.reset`. This undoes the
- action of :func:`repoze.bfg.testing.setUp` called with the
+ action of :func:`pyramid.testing.setUp` called with the
argument ``hook_zca=True``. If :mod:`zope.component` cannot be
imported, ignore the argument.
- .. note:: The ``unhook_zca`` argument is new as of
- :mod:`repoze.bfg` 1.2.
-
.. warning:: Although this method of tearing a test setup down
- will never disappear, after :mod:`repoze.bfg` 1.2a6,
+ will never disappear, after :mod:`pyramid` 1.0,
using the ``begin`` and ``end`` methods of a
``Configurator`` are preferred to using
- ``repoze.bfg.testing.setUp`` and
- ``repoze.bfg.testing.tearDown``. See
+ ``pyramid.testing.setUp`` and
+ ``pyramid.testing.tearDown``. See
:ref:`unittesting_chapter` for more information.
"""
@@ -707,15 +685,15 @@ def tearDown(unhook_zca=True):
_clearContext() # XXX why?
def cleanUp(*arg, **kw):
- """ :func:`repoze.bfg.testing.cleanUp` is an alias for
- :func:`repoze.bfg.testing.setUp`. Although this function is
- effectively deprecated as of :mod:`repoze.bfg` 1.1, due to its
+ """ :func:`pyramid.testing.cleanUp` is an alias for
+ :func:`pyramid.testing.setUp`. Although this function is
+ effectively deprecated as of :mod:`pyramid` 1.0, due to its
extensive production usage, it will never be removed."""
return setUp(*arg, **kw)
class DummyRendererFactory(object):
""" Registered by
- ``repoze.bfg.configuration.Configurator.testing_add_renderer`` as
+ ``pyramid.configuration.Configurator.testing_add_renderer`` as
a dummy renderer factory. The indecision about what to use as a
key (a spec vs. a relative name) is caused by test suites in the
wild believing they can register either. The ``factory`` argument
diff --git a/pyramid/tests/test_configuration.py b/pyramid/tests/test_configuration.py
index 7b121f930..f3958c7de 100644
--- a/pyramid/tests/test_configuration.py
+++ b/pyramid/tests/test_configuration.py
@@ -145,7 +145,7 @@ class ConfiguratorTests(unittest.TestCase):
from pyramid.interfaces import IDebugLogger
config = self._makeOne()
logger = config.registry.getUtility(IDebugLogger)
- self.assertEqual(logger.name, 'repoze.bfg.debug')
+ self.assertEqual(logger.name, 'pyramid.debug')
def test_ctor_noreg_debug_logger_non_None(self):
from pyramid.interfaces import IDebugLogger
@@ -299,7 +299,7 @@ class ConfiguratorTests(unittest.TestCase):
config = self._makeOne(reg)
config.setup_registry()
logger = reg.getUtility(IDebugLogger)
- self.assertEqual(logger.name, 'repoze.bfg.debug')
+ self.assertEqual(logger.name, 'pyramid.debug')
def test_setup_registry_debug_logger_non_None(self):
from pyramid.registry import Registry
@@ -3927,50 +3927,6 @@ class TestRequestOnly(unittest.TestCase):
foo = Foo()
self.assertFalse(self._callFUT(foo))
-class TestMakeApp(unittest.TestCase):
- def setUp(self):
- testing.setUp()
-
- def tearDown(self):
- testing.tearDown()
-
- def _callFUT(self, *arg, **kw):
- from pyramid.configuration import make_app
- return make_app(*arg, **kw)
-
- def test_it(self):
- settings = {'a':1}
- rootfactory = object()
- app = self._callFUT(rootfactory, settings=settings,
- Configurator=DummyConfigurator)
- self.assertEqual(app.root_factory, rootfactory)
- self.assertEqual(app.settings, settings)
- self.assertEqual(app.zcml_file, 'configure.zcml')
- self.assertEqual(app.zca_hooked, True)
-
- def test_it_options_means_settings(self):
- settings = {'a':1}
- rootfactory = object()
- app = self._callFUT(rootfactory, options=settings,
- Configurator=DummyConfigurator)
- self.assertEqual(app.root_factory, rootfactory)
- self.assertEqual(app.settings, settings)
- self.assertEqual(app.zcml_file, 'configure.zcml')
-
- def test_it_with_package(self):
- package = object()
- rootfactory = object()
- app = self._callFUT(rootfactory, package=package,
- Configurator=DummyConfigurator)
- self.assertEqual(app.package, package)
-
- def test_it_with_custom_configure_zcml(self):
- rootfactory = object()
- settings = {'configure_zcml':'2.zcml'}
- app = self._callFUT(rootfactory, filename='1.zcml', settings=settings,
- Configurator=DummyConfigurator)
- self.assertEqual(app.zcml_file, '2.zcml')
-
class TestDottedNameResolver(unittest.TestCase):
def _makeOne(self, package=None):
from pyramid.configuration import DottedNameResolver
@@ -4246,29 +4202,6 @@ class DummySecurityPolicy:
def permits(self, context, principals, permission):
return self.permitted
-class DummyConfigurator(object):
- def __init__(self, registry=None, package=None, root_factory=None,
- settings=None):
- self.root_factory = root_factory
- self.package = package
- self.settings = settings
-
- def begin(self, request=None):
- self.begun = True
- self.request = request
-
- def end(self):
- self.ended = True
-
- def load_zcml(self, filename):
- self.zcml_file = filename
-
- def make_wsgi_app(self):
- return self
-
- def hook_zca(self):
- self.zca_hooked = True
-
class DummyAccept(object):
def __init__(self, *matches):
self.matches = list(matches)
diff --git a/pyramid/traversal.py b/pyramid/traversal.py
index 03c7292cf..af0f36d73 100644
--- a/pyramid/traversal.py
+++ b/pyramid/traversal.py
@@ -31,16 +31,16 @@ def find_root(model):
def find_model(model, path):
""" Given a model object and a string or tuple representing a path
(such as the return value of
- :func:`repoze.bfg.traversal.model_path` or
- :func:`repoze.bfg.traversal.model_path_tuple`), return a context
+ :func:`pyramid.traversal.model_path` or
+ :func:`pyramid.traversal.model_path_tuple`), return a context
in this application's model graph at the specified path. The
model passed in *must* be :term:`location`-aware. If the path
cannot be resolved (if the respective node in the graph does not
exist), a :exc:`KeyError` will be raised.
This function is the logical inverse of
- :func:`repoze.bfg.traversal.model_path` and
- :func:`repoze.bfg.traversal.model_path_tuple`; it can resolve any
+ :func:`pyramid.traversal.model_path` and
+ :func:`pyramid.traversal.model_path_tuple`; it can resolve any
path string or tuple generated by either of those functions.
Rules for passing a *string* as the ``path`` argument: if the
@@ -56,7 +56,7 @@ def find_model(model, path):
each path segment must escaped via Python's :mod:`urllib.quote`.
For example, ``/path/to%20the/La%20Pe%C3%B1a`` (absolute) or
``to%20the/La%20Pe%C3%B1a`` (relative). The
- :func:`repoze.bfg.traversal.model_path` function generates strings
+ :func:`pyramid.traversal.model_path` function generates strings
which follow these rules (albeit only absolute ones).
Rules for passing a *tuple* as the ``path`` argument: if the first
@@ -71,7 +71,7 @@ def find_model(model, path):
URL-quoting or UTF-8-encoding of individual path segments within
the tuple is required (each segment may be any string or unicode
object representing a model name). Model path tuples generated by
- :func:`repoze.bfg.traversal.model_path_tuple` can always be
+ :func:`pyramid.traversal.model_path_tuple` can always be
resolved by ``find_model``.
"""
D = traverse(model, path)
@@ -116,7 +116,7 @@ def model_path(model, *elements):
For example, ``/path/to%20the/La%20Pe%C3%B1a``.
This function is a logical inverse of
- :mod:`repoze.bfg.traversal.find_model`: it can be used to generate
+ :mod:`pyramid.traversal.find_model`: it can be used to generate
path references that can later be resolved via that function.
The ``model`` passed in *must* be :term:`location`-aware.
@@ -129,9 +129,9 @@ def model_path(model, *elements):
safety checking of model names is performed. For
instance, if one of the models in your graph has a
``__name__`` which (by error) is a dictionary, the
- :func:`repoze.bfg.traversal.model_path` function will
+ :func:`pyramid.traversal.model_path` function will
attempt to append it to a string and it will cause a
- :exc:`repoze.bfg.exceptions.URLDecodeError`.
+ :exc:`pyramid.exceptions.URLDecodeError`.
.. note:: The :term:`root` model *must* have a ``__name__``
attribute with a value of either ``None`` or the empty
@@ -147,8 +147,8 @@ def model_path(model, *elements):
def traverse(model, path):
"""Given a model object as ``model`` and a string or tuple
representing a path as ``path`` (such as the return value of
- :func:`repoze.bfg.traversal.model_path` or
- :func:`repoze.bfg.traversal.model_path_tuple` or the value of
+ :func:`pyramid.traversal.model_path` or
+ :func:`pyramid.traversal.model_path_tuple` or the value of
``request.environ['PATH_INFO']``), return a dictionary with the
keys ``context``, ``root``, ``view_name``, ``subpath``,
``traversed``, ``virtual_root``, and ``virtual_root_path``.
@@ -233,7 +233,7 @@ def traverse(model, path):
each path segment must escaped via Python's :mod:`urllib.quote`.
For example, ``/path/to%20the/La%20Pe%C3%B1a`` (absolute) or
``to%20the/La%20Pe%C3%B1a`` (relative). The
- :func:`repoze.bfg.traversal.model_path` function generates strings
+ :func:`pyramid.traversal.model_path` function generates strings
which follow these rules (albeit only absolute ones).
Rules for passing a *tuple* as the ``path`` argument: if the first
@@ -253,7 +253,7 @@ def traverse(model, path):
Unicode during traversal: Each segment is URL-unquoted, and
decoded into Unicode. Each segment is assumed to be encoded using
the UTF-8 encoding (or a subset, such as ASCII); a
- :exc:`repoze.bfg.exceptions.URLDecodeError` is raised if a segment
+ :exc:`pyramid.exceptions.URLDecodeError` is raised if a segment
cannot be decoded. If a segment name is empty or if it is ``.``,
it is ignored. If a segment name is ``..``, the previous segment
is deleted, and the ``..`` is ignored. As a result of this
@@ -300,7 +300,7 @@ def model_path_tuple(model, *elements):
path is absolute).
This function is a logical inverse of
- :func:`repoze.bfg.traversal.find_model`: it can be used to
+ :func:`pyramid.traversal.find_model`: it can be used to
generate path references that can later be resolved that function.
The ``model`` passed in *must* be :term:`location`-aware.
@@ -337,7 +337,7 @@ def virtual_root(model, request):
Provided any :term:`model` and a :term:`request` object, return
the model object representing the :term:`virtual root` of the
current :term:`request`. Using a virtual root in a
- :term:`traversal` -based :mod:`repoze.bfg` application permits
+ :term:`traversal` -based :mod:`pyramid` application permits
rooting, for example, the object at the traversal path ``/cms`` at
``http://example.com/`` instead of rooting it at
``http://example.com/cms/``.
@@ -345,7 +345,7 @@ def virtual_root(model, request):
If the ``model`` passed in is a context obtained via
:term:`traversal`, and if the ``HTTP_X_VHM_ROOT`` key is in the
WSGI environment, the value of this key will be treated as a
- 'virtual root path': the :func:`repoze.bfg.traversal.find_model`
+ 'virtual root path': the :func:`pyramid.traversal.find_model`
API will be used to find the virtual root object using this path;
if the object is found, it will be returned. If the
``HTTP_X_VHM_ROOT`` key is is not present in the WSGI environment,
@@ -377,7 +377,7 @@ def traversal_path(path):
segments. Each segment is URL-unquoted, and subsequently decoded
into Unicode. Each segment is assumed to be encoded using the
UTF-8 encoding (or a subset, such as ASCII); a
- :exc:`repoze.bfg.exceptions.URLDecodeError` is raised if a segment
+ :exc:`pyramid.exceptions.URLDecodeError` is raised if a segment
cannot be decoded. If a segment name is empty or if it is ``.``,
it is ignored. If a segment name is ``..``, the previous segment
is deleted, and the ``..`` is ignored.
@@ -388,15 +388,6 @@ def traversal_path(path):
Unicode object with characters that cannot be encoded to ascii)
will not.
- .. note: New in version 1.3, this API eagerly attempts to encode a
- Unicode ``path`` into ASCII before attempting to split it and
- decode its segments. This is for convenience. In version 1.2
- and prior, if the path was Unicode, an inappropriate call to
- the ``decode()`` method of a Unicode path segment could cause a
- ``UnicodeDecodeError`` to occur even if the Unicode
- representation of the path contained no 'high order'
- characters.
-
Examples:
``/``
@@ -432,17 +423,17 @@ def traversal_path(path):
(u'archives', u'<unprintable unicode>')
.. note:: This function does not generate the same type of tuples
- that :func:`repoze.bfg.traversal.model_path_tuple` does.
+ that :func:`pyramid.traversal.model_path_tuple` does.
In particular, the leading empty string is not present
in the tuple it returns, unlike tuples returned by
- :func:`repoze.bfg.traversal.model_path_tuple`. As a
+ :func:`pyramid.traversal.model_path_tuple`. As a
result, tuples generated by ``traversal_path`` are not
resolveable by the
- :func:`repoze.bfg.traversal.find_model` API.
+ :func:`pyramid.traversal.find_model` API.
``traversal_path`` is a function mostly used by the
- internals of :mod:`repoze.bfg` and by people writing
+ internals of :mod:`pyramid` and by people writing
their own traversal machinery, as opposed to users
- writing applications in :mod:`repoze.bfg`.
+ writing applications in :mod:`pyramid`.
"""
if isinstance(path, unicode):
path = path.encode('ascii')
diff --git a/pyramid/url.py b/pyramid/url.py
index 8dca12c0c..9d94a44f5 100644
--- a/pyramid/url.py
+++ b/pyramid/url.py
@@ -1,4 +1,4 @@
-""" Utility functions for dealing with URLs in repoze.bfg """
+""" Utility functions for dealing with URLs in pyramid """
import os
@@ -15,7 +15,7 @@ from pyramid.traversal import TraversalContextURL
from pyramid.traversal import quote_path_segment
def route_url(route_name, request, *elements, **kw):
- """Generates a fully qualified URL for a named :mod:`repoze.bfg`
+ """Generates a fully qualified URL for a named :mod:`pyramid`
:term:`route configuration`.
Use the route's ``name`` as the first positional argument. Use a
@@ -56,7 +56,7 @@ def route_url(route_name, request, *elements, **kw):
*or* a data structure with an ``.items()`` method that returns a
sequence of two-tuples (presumably a dictionary). This data
structure will be turned into a query string per the documentation
- of :func:`repoze.bfg.encode.urlencode` function. After the query
+ of :func:`pyramid.encode.urlencode` function. After the query
data is turned into a query string, a leading ``?`` is prepended,
and the resulting string is appended to the generated URL.
@@ -95,9 +95,6 @@ def route_url(route_name, request, *elements, **kw):
``request.application_url`` will be used as the prefix (the
default).
- .. note:: Special treatment of ``_app_url`` was added in
- :mod:`repoze.bfg` 1.3.
-
This function raises a :exc:`KeyError` if the URL cannot be
generated due to missing replacement names. Extra replacement
names are ignored.
@@ -269,7 +266,7 @@ def static_url(path, request, **kw):
"""
Generates a fully qualified URL for a static :term:`resource`.
The resource must live within a location defined via the
- :meth:`repoze.bfg.configuration.Configurator.add_static_view`
+ :meth:`pyramid.configuration.Configurator.add_static_view`
:term:`configuration declaration` or the ``<static>`` ZCML
directive (see :ref:`static_resources_section`).
@@ -290,7 +287,7 @@ def static_url(path, request, **kw):
The ``request`` argument should be a :term:`request` object.
The purpose of the ``**kw`` argument is the same as the purpose of
- the :func:`repoze.bfg.url.route_url` ``**kw`` argument. See the
+ the :func:`pyramid.url.route_url` ``**kw`` argument. See the
documentation for that function to understand the arguments which
you can provide to it. However, typically, you don't need to pass
anything as ``*kw`` when generating a static resource URL.
@@ -298,7 +295,6 @@ def static_url(path, request, **kw):
This function raises a :exc:`ValueError` if a static view
definition cannot be found which matches the path specification.
- .. note:: This feature is new in :mod:`repoze.bfg` 1.1.
"""
if os.path.isabs(path):
raise ValueError('Absolute paths cannot be used to generate static '
diff --git a/pyramid/view.py b/pyramid/view.py
index fb4e21b41..62c37849f 100644
--- a/pyramid/view.py
+++ b/pyramid/view.py
@@ -15,7 +15,6 @@ from webob.exc import HTTPFound
import venusian
-from zope.deprecation import deprecated
from zope.interface import providedBy
from pyramid.interfaces import IRoutesMapper
@@ -27,23 +26,6 @@ from pyramid.resource import resource_spec_from_abspath
from pyramid.static import static_view as static # B/C
from pyramid.threadlocal import get_current_registry
-# b/c imports
-from pyramid.security import view_execution_permitted
-
-view_execution_permitted # prevent PyFlakes from complaining
-
-deprecated('view_execution_permitted',
- "('from repoze.bfg.view import view_execution_permitted' was "
- "deprecated as of repoze.bfg 1.0; instead use 'from "
- "repoze.bfg.security import view_execution_permitted')",
- )
-
-deprecated('NotFound',
- "('from repoze.bfg.view import NotFound' was "
- "deprecated as of repoze.bfg 1.1; instead use 'from "
- "repoze.bfg.exceptions import NotFound')",
- )
-
static = static # dont yet deprecate this (ever?)
_marker = object()
@@ -61,7 +43,7 @@ def render_view_to_response(context, request, name='', secure=True):
protected by a permission, the permission will be checked before
calling the view function. If the permission check disallows view
execution (based on the current :term:`authorization policy`), a
- :exc:`repoze.bfg.exceptions.Forbidden` exception will be raised.
+ :exc:`pyramid.exceptions.Forbidden` exception will be raised.
The exception's ``args`` attribute explains why the view access
was disallowed.
@@ -99,13 +81,13 @@ def render_view_to_iterable(context, request, name='', secure=True):
You can usually get the string representation of the return value
of this function by calling ``''.join(iterable)``, or just use
- :func:`repoze.bfg.view.render_view` instead.
+ :func:`pyramid.view.render_view` instead.
If ``secure`` is ``True``, and the view is protected by a
permission, the permission will be checked before the view
function is invoked. If the permission check disallows view
execution (based on the current :term:`authentication policy`), a
- :exc:`repoze.bfg.exceptions.Forbidden` exception will be raised;
+ :exc:`pyramid.exceptions.Forbidden` exception will be raised;
its ``args`` attribute explains why the view access was
disallowed.
@@ -134,7 +116,7 @@ def render_view(context, request, name='', secure=True):
permission, the permission will be checked before the view is
invoked. If the permission check disallows view execution (based
on the current :term:`authorization policy`), a
- :exc:`repoze.bfg.exceptions.Forbidden` exception will be raised;
+ :exc:`pyramid.exceptions.Forbidden` exception will be raised;
its ``args`` attribute explains why the view access was
disallowed.
@@ -177,7 +159,7 @@ class bfg_view(object):
return 'OK'
Might replace the following call to the
- :meth:`repoze.bfg.configuration.Configurator.add_view` method::
+ :meth:`pyramid.configuration.Configurator.add_view` method::
import views
import models
@@ -223,7 +205,7 @@ class bfg_view(object):
view wrapper is associated with this view).
If ``request_type`` is not supplied, the interface
- :class:`repoze.bfg.interfaces.IRequest` is used, implying the
+ :class:`pyramid.interfaces.IRequest` is used, implying the
standard request interface type.
If ``route_name`` is not supplied, the view configuration is
@@ -309,7 +291,7 @@ class bfg_view(object):
class decorators)::
from webob import Response
- from repoze.bfg.view import bfg_view
+ from pyramid.view import bfg_view
@bfg_view()
class MyView(object):
@@ -323,7 +305,7 @@ class bfg_view(object):
used against a class, although not in decorator form::
from webob import Response
- from repoze.bfg.view import bfg_view
+ from pyramid.view import bfg_view
class MyView(object):
def __init__(self, context, request):
@@ -344,7 +326,7 @@ class bfg_view(object):
The bfg_view decorator can also be used against a class method::
from webob import Response
- from repoze.bfg.view import bfg_view
+ from pyramid.view import bfg_view
class MyView(object):
def __init__(self, context, request):
@@ -367,7 +349,7 @@ class bfg_view(object):
spelled equivalently as::
from webob import Response
- from repoze.bfg.view import bfg_view
+ from pyramid.view import bfg_view
@bfg_view(attr='amethod', name='hello')
class MyView(object):
@@ -379,7 +361,7 @@ class bfg_view(object):
return Response('hello from %s!' % self.context)
.. warning:: The ability to use the ``bfg_view`` decorator as a
- method decorator is new in :mod:`repoze.bfg` version
+ method decorator is new in :mod:`pyramid` version
1.1.
To make use of any ``bfg_view`` declaration, you must perform a
@@ -392,7 +374,7 @@ class bfg_view(object):
``scan`` directive.
Or, if you don't use ZCML, use the
- :meth:`repoze.bfg.configuration.Configurator.scan` method::
+ :meth:`pyramid.configuration.Configurator.scan` method::
config.scan()
"""
@@ -459,15 +441,15 @@ def default_exceptionresponse_view(context, request):
class AppendSlashNotFoundViewFactory(object):
""" There can only be one :term:`Not Found view` in any
- :mod:`repoze.bfg` application. Even if you use
- :func:`repoze.bfg.view.append_slash_notfound_view` as the Not
- Found view, :mod:`repoze.bfg` still must generate a ``404 Not
+ :mod:`pyramid` application. Even if you use
+ :func:`pyramid.view.append_slash_notfound_view` as the Not
+ Found view, :mod:`pyramid` still must generate a ``404 Not
Found`` response when it cannot redirect to a slash-appended URL;
this not found response will be visible to site users.
If you don't care what this 404 response looks like, and you only
need redirections to slash-appended route URLs, you may use the
- :func:`repoze.bfg.view.append_slash_notfound_view` object as the
+ :func:`pyramid.view.append_slash_notfound_view` object as the
Not Found view. However, if you wish to use a *custom* notfound
view callable when a URL cannot be redirected to a slash-appended
URL, you may wish to use an instance of this class as the Not
@@ -477,8 +459,8 @@ class AppendSlashNotFoundViewFactory(object):
.. code-block:: python
- from repoze.bfg.exceptions import NotFound
- from repoze.bfg.view import AppendSlashNotFoundViewFactory
+ from pyramid.exceptions import NotFound
+ from pyramid.view import AppendSlashNotFoundViewFactory
def notfound_view(context, request):
return HTTPNotFound('It aint there, stop trying!')
@@ -490,8 +472,6 @@ class AppendSlashNotFoundViewFactory(object):
view callable calling convention of ``(context, request)``
(``context`` will be the exception object).
- .. note:: This class is new as of :mod:`repoze.bfg` version 1.3.
-
"""
def __init__(self, notfound_view=None):
if notfound_view is None:
@@ -531,20 +511,19 @@ If you use :term:`ZCML`, add the following to your application's
``configure.zcml`` to use this view as the Not Found view::
<view
- context="repoze.bfg.exceptions.NotFound"
- view="repoze.bfg.view.append_slash_notfound_view"/>
+ context="pyramid.exceptions.NotFound"
+ view="pyramid.view.append_slash_notfound_view"/>
Or use the
-:meth:`repoze.bfg.configuration.Configurator.add_view`
+:meth:`pyramid.configuration.Configurator.add_view`
method if you don't use ZCML::
- from repoze.bfg.exceptions import NotFound
- from repoze.bfg.view import append_slash_notfound_view
+ from pyramid.exceptions import NotFound
+ from pyramid.view import append_slash_notfound_view
config.add_view(append_slash_notfound_view, context=NotFound)
See also :ref:`changing_the_notfound_view`.
-.. note:: This function is new as of :mod:`repoze.bfg` version 1.1.
"""
diff --git a/pyramid/wsgi.py b/pyramid/wsgi.py
index 152e3a72b..a93b977f3 100644
--- a/pyramid/wsgi.py
+++ b/pyramid/wsgi.py
@@ -2,9 +2,9 @@ from pyramid.compat import wraps
from pyramid.traversal import quote_path_segment
def wsgiapp(wrapped):
- """ Decorator to turn a WSGI application into a :mod:`repoze.bfg`
+ """ Decorator to turn a WSGI application into a :mod:`pyramid`
:term:`view callable`. This decorator differs from the
- :func:`repoze.bfg.wsgi.wsgiapp2` decorator inasmuch as fixups of
+ :func:`pyramid.wsgi.wsgiapp2` decorator inasmuch as fixups of
``PATH_INFO`` and ``SCRIPT_NAME`` within the WSGI environment *are
not* performed before the application is invoked.
@@ -25,14 +25,14 @@ def wsgiapp(wrapped):
/>
Or the following call to
- :meth:`repoze.bfg.configuration.Configurator.add_view`::
+ :meth:`pyramid.configuration.Configurator.add_view`::
from views import hello_world
config.add_view(hello_world, name='hello_world.txt')
The ``wsgiapp`` decorator will convert the result of the WSGI
application to a :term:`Response` and return it to
- :mod:`repoze.bfg` as if the WSGI app were a :mod:`repoze.bfg`
+ :mod:`pyramid` as if the WSGI app were a :mod:`pyramid`
view.
"""
@@ -41,9 +41,9 @@ def wsgiapp(wrapped):
return wraps(wrapped)(decorator) # grokkability
def wsgiapp2(wrapped):
- """ Decorator to turn a WSGI application into a :mod:`repoze.bfg`
+ """ Decorator to turn a WSGI application into a :mod:`pyramid`
view callable. This decorator differs from the
- :func:`repoze.bfg.wsgi.wsgiapp` decorator inasmuch as fixups of
+ :func:`pyramid.wsgi.wsgiapp` decorator inasmuch as fixups of
``PATH_INFO`` and ``SCRIPT_NAME`` within the WSGI environment
*are* performed before the application is invoked.
@@ -64,14 +64,14 @@ def wsgiapp2(wrapped):
/>
Or the following call to
- :meth:`repoze.bfg.configuration.Configurator.add_view`::
+ :meth:`pyramid.configuration.Configurator.add_view`::
from views import hello_world
config.add_view(hello_world, name='hello_world.txt')
The ``wsgiapp2`` decorator will convert the result of the WSGI
- application to a Response and return it to :mod:`repoze.bfg` as if
- the WSGI app were a :mod:`repoze.bfg` view. The ``SCRIPT_NAME``
+ application to a Response and return it to :mod:`pyramid` as if
+ the WSGI app were a :mod:`pyramid` view. The ``SCRIPT_NAME``
and ``PATH_INFO`` values present in the WSGI environment are fixed
up before the application is invoked. """
diff --git a/pyramid/zcml.py b/pyramid/zcml.py
index 561beb857..6d481bd8c 100644
--- a/pyramid/zcml.py
+++ b/pyramid/zcml.py
@@ -88,7 +88,7 @@ class IViewDirective(Interface):
title=u"The request type string or dotted name interface for the view",
description=(u"The view will be called if the interface represented by "
u"'request_type' is implemented by the request. The "
- u"default request type is repoze.bfg.interfaces.IRequest"),
+ u"default request type is pyramid.interfaces.IRequest"),
required=False
)
@@ -881,7 +881,6 @@ def zcml_configure(name, package):
``package`` which the filename should be relative to, load the
ZCML into the current ZCML registry.
- .. note:: This feature is new as of :mod:`repoze.bfg` 1.1.
"""
context = ConfigurationMachine()
xmlconfig.registerCommonDirectives(context)