Merge lp:~marenhachmann/inkscape-web/bug1389421 into lp:inkscape-web

Proposed by Hachmann
Status: Merged
Merged at revision: 585
Proposed branch: lp:~marenhachmann/inkscape-web/bug1389421
Merge into: lp:inkscape-web
Diff against target: 24 lines (+4/-2)
1 file modified
inkscape/resource/views.py (+4/-2)
To merge this branch: bzr merge lp:~marenhachmann/inkscape-web/bug1389421
Reviewer Review Type Date Requested Status
Martin Owens Approve
Review via email: mp+241217@code.launchpad.net

Description of the change

In a gallery with 3 rows à 5 items, there are now always 15 boxes, even if one of them is the drop-site box for uploading a new item.

To post a comment you must log in.
Revision history for this message
Hachmann (marenhachmann) wrote :

In the resources views file, there is one other occurance of the limit 15, but as far as I could follow it, that function never results in a drop-site being shown, so here an adaptation does not seem necessary to me. Hope I got that right. Can you confirm?

Revision history for this message
Martin Owens (doctormo) wrote :

So the reason this bug appeared was because I removed the limit modifier from the template and into the views as lists were included in other templates.

I'm not sure I like the verbose nature of this solution. A simpler way would be:

'limit' : 15 - gallery.is_editable(request.user),

Also don't forget to keep a comma at the end of each line in a dictionary, tuple or list. Line 23 in the diff shows you removed the comma from the breadcrumb entry, which is what you may do for C/C++ but python should allow for those to help with diff clarity.

I wasn't sure if the limit change should exist on both, and I certainly wasn't sure if the change should be in the view.py instead of the template (somehow) but I defer here because worrying about it excessively would be time consuming :-)

review: Needs Fixing
583. By Maren Hachmann <email address hidden>

Changed as proposed

584. By Maren Hachmann <email address hidden>

merged in current trunk

Revision history for this message
Martin Owens (doctormo) wrote :

There's no reason to have the limit setter outside of the dictionary braces now it's just one line.

585. By Maren Hachmann <email address hidden>

now limit is inside the braces

Revision history for this message
Martin Owens (doctormo) wrote :

Perfect! I love how small these fixes are :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'inkscape/resource/views.py'
2--- inkscape/resource/views.py 2014-10-24 22:51:09 +0000
3+++ inkscape/resource/views.py 2014-11-10 20:05:28 +0000
4@@ -225,8 +225,9 @@
5 'items' : gallery.items.for_user(request.user),
6 'gallery' : gallery,
7 'breadcrumbs': breadcrumbs(gallery.user, gallery),
8- 'limit' : 15,
9+ 'limit' : 15 - gallery.is_editable(request.user),
10 }
11+
12 if gallery.group:
13 c['breadcrumbs'] = breadcrumbs(gallery)
14
15@@ -243,8 +244,9 @@
16 'me': user == request.user,
17 'items': user.galleries.for_user(request.user),
18 'breadcrumbs': breadcrumbs(user, "Galleries"),
19- 'limit': 15,
20+ 'limit' : 15 - (user == request.user),
21 }
22+
23 return render_to_response('resource/user.html', c,
24 context_instance=RequestContext(request))
25

Subscribers

People subscribed via source and target branches

to status/vote changes: