Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix status_iterator deprecation warning #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Fix status_iterator deprecation warning #255

wants to merge 2 commits into from

Conversation

pllim
Copy link
Contributor

@pllim pllim commented Jun 20, 2017

Fix this warning with Sphinx 1.6:

.../sphinx/application.py:445: RemovedInSphinx17Warning:
    app.status_iterator() is now deprecated. Use sphinx.util.status_iterator() instead.
  RemovedInSphinx17Warning)

c/c @bsipocz

iterator = app.status_iterator(
flat, os.path.basename(html_gallery_dir), colorfunc=fuchsia,
length=len(flat), stringify_func=lambda x: os.path.basename(x[1]))
if status_iterator is None:
Copy link
Member

@lesteve lesteve Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR. For slightly better readability, I would do something like:

try:
    from sphinx.util import status_iterator
except ImportError:
    # sphinx < 1.6
    status_iterator = app.status_iterator

iterator = status_iterator(...)

i.e. put the import in the _embed_code_links function.

@Titan-C
Copy link
Member

Titan-C commented Jun 27, 2017

I actually prefer the solution from PR #250

@pllim
Copy link
Contributor Author

pllim commented Jun 27, 2017

Ah, I was unaware of the fix being implemented already on #250.

@pllim pllim closed this Jun 27, 2017
@pllim pllim deleted the stat-iter-deprec branch June 27, 2017 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants