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

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

Open
SundialServices opened this issue Apr 3, 2020 · 6 comments

Comments

@SundialServices
Copy link

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
Copy link
Owner

can you write more information about usage and trace?

@SundialServices
Copy link
Author

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
Copy link
Author

SundialServices commented Apr 3, 2020

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
Copy link
Owner

did you tried latest 3.3.0 version ?

@SundialServices
Copy link
Author

SundialServices commented Apr 3, 2020

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
Copy link
Author

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

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