Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(811)

Unified Diff: MoinMoin/apps/frontend/views.py

Issue 4811051: paging code at item history moved under util
Patch Set: Created 13 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | MoinMoin/templates/history.html » ('j') | MoinMoin/util/__init__.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: MoinMoin/apps/frontend/views.py
===================================================================
--- a/MoinMoin/apps/frontend/views.py
+++ b/MoinMoin/apps/frontend/views.py
@@ -42,7 +42,7 @@
from MoinMoin.apps.frontend import frontend
from MoinMoin.items import Item, NonExistent
from MoinMoin.items import ROWS_META, COLS, ROWS_DATA
-from MoinMoin import config, user, wikiutil
+from MoinMoin import config, user, util, wikiutil
from MoinMoin.config import ACTION, COMMENT, CONTENTTYPE, ITEMLINKS, ITEMTRANSCLUSIONS, NAME, CONTENTTYPE_GROUPS
from MoinMoin.util.forms import make_generator
from MoinMoin.util import crypto
@@ -585,7 +585,6 @@
@frontend.route('/+history/<itemname:item_name>')
def history(item_name):
history = flaskg.storage.history(item_name=item_name)
- selected_history = []
offset = request.values.get('offset', 0)
offset = max(int(offset), 0)
@@ -593,33 +592,11 @@
results_per_page = int(app.cfg.results_per_page)
if flaskg.user.valid:
results_per_page = flaskg.user.results_per_page
-
- revcount = 0
- maxcount = offset + results_per_page
- nextPage = False
- for rev in history:
- if revcount < offset:
- revcount += 1
- elif results_per_page and revcount == maxcount:
- nextPage = True
- break
- else:
- selected_history.append(rev)
- revcount += 1
-
- if not nextPage:
- revcount = 0
-
- if results_per_page and offset:
- previous_offset = max(offset - results_per_page, 0)
- else:
- previous_offset = -1
+ result = util.getPageContent(history, offset, results_per_page)
Reimar Bauer 2011/07/24 20:59:37 if it is selected_content please name it not resul
return render_template('history.html',
item_name=item_name, # XXX no item here
- history=selected_history,
- offset=revcount,
- previous_offset=previous_offset,
+ result=result,
)
@frontend.route('/+history')
« no previous file with comments | « no previous file | MoinMoin/templates/history.html » ('j') | MoinMoin/util/__init__.py » ('J')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b