summaryrefslogtreecommitdiff
path: root/repoze/bfg/configuration.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2010-04-21 10:35:07 +0000
committerChris McDonough <chrism@agendaless.com>2010-04-21 10:35:07 +0000
commit51981a128c7ed05e51938a3f358c0970dcc33a6f (patch)
tree60b8b1cde60e28ea2d1bc6139dab47de444b0ed6 /repoze/bfg/configuration.py
parent1c7039e337401ceb7eb16040234dcf9da8335f55 (diff)
downloadpyramid-51981a128c7ed05e51938a3f358c0970dcc33a6f.tar.gz
pyramid-51981a128c7ed05e51938a3f358c0970dcc33a6f.tar.bz2
pyramid-51981a128c7ed05e51938a3f358c0970dcc33a6f.zip
Moved i18n work to a branch and revert to pre-i18n-feature state via svn merge -r9054:9030 svn+ssh://repoze@svn.repoze.org/svn/repoze.bfg/trunk
Diffstat (limited to 'repoze/bfg/configuration.py')
-rw-r--r--repoze/bfg/configuration.py35
1 files changed, 8 insertions, 27 deletions
diff --git a/repoze/bfg/configuration.py b/repoze/bfg/configuration.py
index a98b3e7d6..4673479da 100644
--- a/repoze/bfg/configuration.py
+++ b/repoze/bfg/configuration.py
@@ -17,7 +17,6 @@ from zope.interface import implements
from repoze.bfg.interfaces import IAuthenticationPolicy
from repoze.bfg.interfaces import IAuthorizationPolicy
-from repoze.bfg.interfaces import IChameleonTranslate
from repoze.bfg.interfaces import IDebugLogger
from repoze.bfg.interfaces import IDefaultRootFactory
from repoze.bfg.interfaces import IExceptionViewClassifier
@@ -32,7 +31,6 @@ from repoze.bfg.interfaces import IRoutesMapper
from repoze.bfg.interfaces import ISecuredView
from repoze.bfg.interfaces import ISettings
from repoze.bfg.interfaces import ITemplateRenderer
-from repoze.bfg.interfaces import ITranslatorFactory
from repoze.bfg.interfaces import ITraverser
from repoze.bfg.interfaces import IView
from repoze.bfg.interfaces import IViewClassifier
@@ -47,7 +45,6 @@ from repoze.bfg.events import WSGIApplicationCreatedEvent
from repoze.bfg.exceptions import Forbidden
from repoze.bfg.exceptions import NotFound
from repoze.bfg.exceptions import ConfigurationError
-from repoze.bfg.i18n import ChameleonTranslate
from repoze.bfg.log import make_stream_logger
from repoze.bfg.path import caller_package
from repoze.bfg.registry import Registry
@@ -138,23 +135,14 @@ class Configurator(object):
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. The debug logger is used by :mod:`repoze.bfg` itself to
- log warnings and authorization debugging information.
-
- If ``translator_factory`` is passed, it should be a
- :term:`translator factory` object. A translator factory is an
- object which accepts a request and which returns a translation
- function. The translation function accepts a :term:`translation
- string` and returns a Unicode object representing the translated
- string. The default for ``translator_factory`` is ``None``,
- meaning that no translation is performed during template
- rendering. """
+ log warnings and authorization debugging information. """
manager = manager # for testing injection
venusian = venusian # for testing injection
def __init__(self, registry=None, package=None, settings=None,
root_factory=None, authentication_policy=None,
authorization_policy=None, renderers=DEFAULT_RENDERERS,
- debug_logger=None, translator_factory=None):
+ debug_logger=None):
self.package = package or caller_package()
self.registry = registry
if registry is None:
@@ -166,8 +154,7 @@ class Configurator(object):
authentication_policy=authentication_policy,
authorization_policy=authorization_policy,
renderers=renderers,
- debug_logger=debug_logger,
- translator_factory=translator_factory)
+ debug_logger=debug_logger)
def _set_settings(self, mapping):
settings = Settings(mapping or {})
@@ -283,8 +270,7 @@ class Configurator(object):
def setup_registry(self, settings=None, root_factory=None,
authentication_policy=None, authorization_policy=None,
- renderers=DEFAULT_RENDERERS, debug_logger=None,
- translator_factory=None):
+ renderers=DEFAULT_RENDERERS, debug_logger=None):
""" When you pass a non-``None`` ``registry`` argument to the
:term:`Configurator` constructor, no initial 'setup' is
performed against the registry. This is because the registry
@@ -318,8 +304,6 @@ class Configurator(object):
self.add_renderer(name, renderer)
self.set_notfound_view(default_notfound_view)
self.set_forbidden_view(default_forbidden_view)
- if translator_factory is not None:
- self.set_translator_factory(translator_factory)
# getSiteManager is a unit testing dep injection
def hook_zca(self, getSiteManager=None):
@@ -1241,6 +1225,10 @@ class Configurator(object):
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:`repoze.bfg` 1.3. See
+ :ref:`changing_the_forbidden_view` to see how a not found
+ view should be registered in :mod:`repoze.bfg` 1.3+.
The ``view`` argument should be a :term:`view callable`.
@@ -1311,13 +1299,6 @@ class Configurator(object):
return self.add_view(bwcompat_view, context=NotFound,
wrapper=wrapper, _info=_info)
- def set_translator_factory(self, factory):
- """ Set ``factory`` up as the current application
- :term:`translator factory` (for internationalization)"""
- self.registry.registerUtility(factory, ITranslatorFactory)
- ctranslate = ChameleonTranslate(factory)
- self.registry.registerUtility(ctranslate, IChameleonTranslate)
-
def add_static_view(self, name, path, cache_max_age=3600, _info=u''):
""" Add a view used to render static resources to the current
configuration state.