From 51981a128c7ed05e51938a3f358c0970dcc33a6f Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 21 Apr 2010 10:35:07 +0000 Subject: 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 --- repoze/bfg/configuration.py | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'repoze/bfg/configuration.py') 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. -- cgit v1.2.3