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

Python 3.4 support #18

Closed
ak4nv opened this issue Oct 14, 2014 · 8 comments
Closed

Python 3.4 support #18

ak4nv opened this issue Oct 14, 2014 · 8 comments

Comments

@ak4nv
Copy link

ak4nv commented Oct 14, 2014

I use python 3.4 and Flask 0.10.1
Pagination.links gets an exeption AttributeError: 'ImmutableMultiDict' object has no attribute 'iteritems'
on this line:
https://github.com/lixxu/flask-paginate/blob/master/flask_paginate/__init__.py#L207

python
args = MultiDict(list(request.args.iteritems(multi=True)) + request.view_args.items())


This fork works well: https://github.com/nesforge/flask-paginate
Patch: https://github.com/nesforge/flask-paginate/commit/6ea9b821e14e1a92884bf2ebd152cf400caa42e9
@lixxu
Copy link
Owner

lixxu commented Oct 15, 2014

MultiDict is need by 9928ed2

@lixxu
Copy link
Owner

lixxu commented Oct 15, 2014

I upload a new version to try to fix this issue (not test under Python3.4). If this is work for you, I'll close it. Hope it can work. :)

@ak4nv
Copy link
Author

ak4nv commented Oct 16, 2014

It works fine! You may close this issue.
Thanks!
P.S. Will you update version for pypi?

@ak4nv ak4nv closed this as completed Oct 16, 2014
@lixxu
Copy link
Owner

lixxu commented Oct 16, 2014

Already update for pypi.

@ak4nv
Copy link
Author

ak4nv commented Oct 16, 2014

My apologies. Another exception:

  File "/var/www/tm/.env/lib/python3.4/site-packages/jinja2/environment.py", line 397, in getattr
    return getattr(obj, attribute)
  File "/var/www/tm/.env/lib/python3.4/site-packages/flask_paginate/__init__.py", line 325, in links
    s.append(self.single_page(page) if page else self.gap_marker_fmt)
  File "/var/www/tm/.env/lib/python3.4/site-packages/flask_paginate/__init__.py", line 297, in single_page
    return self.last_page
  File "/var/www/tm/.env/lib/python3.4/site-packages/flask_paginate/__init__.py", line 247, in last_page
    url = self.page_href(self.total_pages)
  File "/var/www/tm/.env/lib/python3.4/site-packages/flask_paginate/__init__.py", line 188, in page_href
    return url_for(self.endpoint, page=page, **self.args)
  File "/var/www/tm/.env/lib/python3.4/site-packages/flask_paginate/__init__.py", line 215, in args
    args = MultiDict(list(args_items) + request.view_args.items())
TypeError: can only concatenate list (not "dict_items") to list

may be?

args = MultiDict(list(args_items) + list(request.view_args.items()))

@ak4nv ak4nv reopened this Oct 16, 2014
@lixxu
Copy link
Owner

lixxu commented Oct 17, 2014

Can you try it and push a merge request?

@pingometer
Copy link

I can confirm the change from @ak04nv fixes it for Python 3.4:

args = MultiDict(list(args_items) + list(request.view_args.items()))

@lixxu
Copy link
Owner

lixxu commented Oct 23, 2014

merged and pushed to 0.2.5, thanks for your time.

@lixxu lixxu closed this as completed Oct 23, 2014
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

3 participants