shtalinberg / django-el-pagination

Django endless pagination tools. Ajax, multiple and lazy pagination, Twitter-style and Digg-style pagination.
MIT License
307 stars 71 forks source link

"int does not have attribute encode" traced to el_pagination in Django 2.2 #146

Open SundialServices opened 4 years ago

SundialServices commented 4 years ago

After recent upgrades, our web-site started breaking with this message, and I have traced it to el_pagination by virtue of the fact that the message stops happening when the tags are removed from the template.

shtalinberg commented 4 years ago

can you write more information about usage and trace?

SundialServices commented 4 years ago

Traceback is as follows. Problem occurs on every release all the way back to 2.1.2 which doesn't run.

Internal Server Error: /archives/menu Traceback (most recent call last): File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response response = self.process_exception_by_middleware(e, request) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view return self.dispatch(request, *args, **kwargs) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/contrib/auth/mixins.py", line 52, in dispatch return super().dispatch(request, *args, **kwargs) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch return handler(request, *args, **kwargs) File "/Users/mike/projects/GGA/archives/views.py", line 51, in get 'message': get_and_clear_search_message(request) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/shortcuts.py", line 36, in render content = loader.render_to_string(template_name, context, request, using=using) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/loader.py", line 62, in render_to_string return template.render(context, request) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render return self.template.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 171, in render return self._render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 163, in _render return self.nodelist.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 937, in render bit = node.render_annotated(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated return self.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render return compiled_parent._render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 163, in _render return self.nodelist.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 937, in render bit = node.render_annotated(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated return self.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render return compiled_parent._render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 163, in _render return self.nodelist.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 937, in render bit = node.render_annotated(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated return self.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render result = block.nodelist.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 937, in render bit = node.render_annotated(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated return self.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/defaulttags.py", line 209, in render nodelist.append(node.render_annotated(context)) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated return self.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/defaulttags.py", line 309, in render return nodelist.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 937, in render bit = node.render_annotated(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated return self.render(context) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/el_pagination/templatetags/el_pagination_tags.py", line 572, in render return utils.text(pages) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/el_pagination/utils.py", line 195, in __str__ return self.__unicode__() File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/el_pagination/models.py", line 178, in __unicode__ pages.append(self[item]) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/el_pagination/models.py", line 119, in __getitem__ return self._endless_page(value) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/el_pagination/models.py", line 106, in _endless_page context=self.context File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/el_pagination/models.py", line 54, in __init__ default_number=default_number) File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/el_pagination/utils.py", line 174, in get_querystring_for_page return '?' + querydict.urlencode() File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/http/request.py", line 524, in urlencode for v in list_ File "/Users/mike/.virtualenvs/djangoprod/lib/python3.6/site-packages/django/http/request.py", line 524, in <genexpr> for v in list_ AttributeError: 'int' object has no attribute 'encode

SundialServices commented 4 years ago

The problem disappears only if I remove all el_pagination tags from the template.

I cannot update Django at this time because of host-side problems involving the libgdal library.

If you can see what's wrong here and could "hot-fix" this one, I would be mighty grateful!

shtalinberg commented 4 years ago

did you tried latest 3.3.0 version ?

SundialServices commented 4 years ago

All releases were tried. I first noticed the problem with 3.3.0 and began walking-back through them until I reached 2.1.2 which apparently isn't compatible with this Django. Much to my surprise, every single one produced this problem!

The code had been in production without incident for quite some time. But I am now certain that I have indeed traced it to this package, and it began to appear after other upgrades. Remove these tags and the template renders normally.

SundialServices commented 4 years ago

Correction: my installed version of Django is 2.1. Even more ancient than I thought, and I can't change it yet.