Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#5465 closed defect (fixed)

Python 3: Home page error if more than a single page of media items

Reported by: Ben Sturmfels Owned by:
Priority: major Milestone:
Component: programming Keywords: python3
Cc: Parent Tickets:

Description

I upgraded a MediaGoblin instance with more than 30 media items to Python 3.4 and got the following error when attempting to load the home page:

  File "/home/ben/work/ws/mediagoblin/mediagoblin/tools/pagination.py", line 110, in get_page_url_explicit
    base_url, urllib.urlencode(new_get_params))
AttributeError: 'module' object has no attribute 'urlencode'

Loads fine under Python 2, or with 30 or less media items on Python 3 (only one page).

Attachments (1)

issue_55.patch (6.4 KB ) - added by Ben Sturmfels 8 years ago.
Patch copy of above repository

Download all attachments as: .zip

Change History (8)

comment:1 by Ben Sturmfels, 8 years ago

Owner: set to Ben Sturmfels
Status: newin_progress

I've added fix here:

https://gitlab.com/Sturm/mediagoblin/tree/python3-pagination

(This is the webpage representing a a GitLab branch called "python3-pagination". I don't think you can just git fetch from that though. Will do some more hunting.)

comment:2 by Ben Sturmfels, 8 years ago

Owner: Ben Sturmfels removed
Status: in_progressreview

comment:3 by Ben Sturmfels, 8 years ago

Ok, so the appropriate git command/URLs will, I think, be:

git fetch https://gitlab.com/Sturm/mediagoblin.git python3-pagination

I've tested that without the fix, the new tests pass on Python 2.7 and fail on Python 3.4. When fix is applied, tests pass on both Python 2.7 and 3.4.

comment:4 by Ben Sturmfels, 8 years ago

I've updated the above repository with further Paginator tests, which I believe will then allow us to close both this ticket and #55 "Paginator needs tests". Will attach a patch file too.

by Ben Sturmfels, 8 years ago

Attachment: issue_55.patch added

Patch copy of above repository

comment:5 by Boris Bobrov, 8 years ago

Thank you! Fixed in e17566b, 58b3a65

comment:6 by Boris Bobrov, 8 years ago

Resolution: fixed
Status: reviewclosed

comment:7 by Ben Sturmfels, 8 years ago

Hi Breton,

What are your thoughts on porting this patch to stable? Anyone trying to upgrade/start a new site in Python 3 is going to be bitten by this, and it's likely they'll be running stable rather than master.

(Just ran into it on my own production site.)

Note: See TracTickets for help on using tickets.