mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Deprecate: app.import_object()
This commit is contained in:
parent
3859136342
commit
9d33ec99b4
2
CHANGES
2
CHANGES
@ -21,6 +21,8 @@ Deprecated
|
||||
|
||||
* :confval:`source_parsers` is deprecated. Please use ``add_source_parser()``
|
||||
instead.
|
||||
* ``app.import_object()`` is deprecated. Please use
|
||||
``sphinx.util.import_object()`` instead.
|
||||
|
||||
Features added
|
||||
--------------
|
||||
|
@ -27,7 +27,7 @@ from six.moves import cStringIO
|
||||
import sphinx
|
||||
from sphinx import package_dir, locale
|
||||
from sphinx.config import Config
|
||||
from sphinx.deprecation import RemovedInSphinx20Warning
|
||||
from sphinx.deprecation import RemovedInSphinx20Warning, RemovedInSphinx30Warning
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from sphinx.errors import (
|
||||
ApplicationError, ConfigError, ExtensionError, VersionRequirementError
|
||||
@ -460,10 +460,16 @@ class Sphinx(object):
|
||||
if version > sphinx.__display_version__[:3]:
|
||||
raise VersionRequirementError(version)
|
||||
|
||||
# TODO(stephenfin): Deprecate this as it has no callers and isn't necessary
|
||||
def import_object(self, objname, source=None):
|
||||
# type: (str, unicode) -> Any
|
||||
"""Import an object from a ``module.name`` string."""
|
||||
"""Import an object from a ``module.name`` string.
|
||||
|
||||
.. deprecated:: 1.8
|
||||
Use ``sphinx.util.import_object()`` instead.
|
||||
"""
|
||||
warnings.warn('app.import_object() is deprecated. '
|
||||
'Use sphinx.util.add_object_type() instead.',
|
||||
RemovedInSphinx30Warning)
|
||||
return import_object(objname, source=None)
|
||||
|
||||
# event interface
|
||||
|
@ -16,7 +16,7 @@ from docutils import nodes
|
||||
|
||||
from sphinx.deprecation import RemovedInSphinx20Warning
|
||||
from sphinx.environment.adapters.asset import ImageAdapter
|
||||
from sphinx.util import i18n, path_stabilize, logging, status_iterator
|
||||
from sphinx.util import i18n, import_object, path_stabilize, logging, status_iterator
|
||||
from sphinx.util.console import bold # type: ignore
|
||||
from sphinx.util.i18n import find_catalog
|
||||
from sphinx.util.osutil import SEP, ensuredir, relative_uri
|
||||
@ -159,8 +159,8 @@ class Builder(object):
|
||||
# type: () -> None
|
||||
"""Return the template bridge configured."""
|
||||
if self.config.template_bridge:
|
||||
self.templates = self.app.import_object(
|
||||
self.config.template_bridge, 'template_bridge setting')()
|
||||
self.templates = import_object(self.config.template_bridge,
|
||||
'template_bridge setting')()
|
||||
else:
|
||||
from sphinx.jinja2glue import BuiltinTemplateLoader
|
||||
self.templates = BuiltinTemplateLoader()
|
||||
|
Loading…
Reference in New Issue
Block a user