Skip to content
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

Pagination Causes ValueError from Breadcrumbs #551

Open
3 tasks done
jplehmann opened this issue Dec 3, 2018 · 3 comments
Open
3 tasks done

Pagination Causes ValueError from Breadcrumbs #551

jplehmann opened this issue Dec 3, 2018 · 3 comments

Comments

@jplehmann
Copy link

Actual behavior

Upon upgrading several versions of Django and Zinnia, I started seeing exceptions in production for pagination beyond page 1.

IndexError at /blog/
list index out of range

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/library.py" in render
  225.         _dict = self.func(*resolved_args, **resolved_kwargs)

File "/app/.heroku/python/lib/python2.7/site-packages/zinnia/templatetags/zinnia.py" in zinnia_breadcrumbs
  327.         path, context_object, context_page, root_name)

File "/app/.heroku/python/lib/python2.7/site-packages/zinnia/breadcrumbs.py" in wrapper
  95.                 breadcrumbs[-1].url = path

Exception Type: IndexError at /blog/
Exception Value: list index out of range
Request information:
USER: AnonymousUser
GET:
page = u'2'

Expected behavior

Goes to page 2.

Steps to reproduce the issue

  1. https://www.morphmarket.com/blog/?page=2

Specifications

  • Zinnia version: 0.19
  • Django version: 1.11
  • Python version: 2.7.15
  • Operating system: Herkou stack, Debian I guess?

Disclaimer

Before submitting an issue make sure you have:

  • Read the guidelines for contributing.
  • Checked for duplicate issues.
  • Not a support request.

I guess this may be something in my configuration since no one else had this issue, but not sure what that would be.

@jplehmann
Copy link
Author

@Fantomas42 any thoughts here? This seems really weird but not too complicated and I'm guessing you'll have ideas right away. Thanks.

@joaolsilva
Copy link

In the file breadcrumbs.py, function "handle_page_crumb" try adding to the if before the crash " and breadcrumbs":

if page.number > 1 and breadcrumbs:

@jplehmann
Copy link
Author

@joaolsilva thank you very much. I guess no one else but me don't use breadcrumbs.

I have created a PR.

jplehmann added a commit to morphmarket/django-blog-zinnia that referenced this issue Feb 18, 2019
doidor pushed a commit to morphmarket/django-blog-zinnia that referenced this issue May 25, 2020
GhalebKhaled pushed a commit to morphmarket/django-blog-zinnia that referenced this issue Jul 26, 2022
dismine added a commit to dismine/django-blog-zinnia that referenced this issue Dec 16, 2022
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

No branches or pull requests

2 participants