annotate MoinMoin/apps/admin/views.py @ 107:1a047dcf791c

admin views: use abort(403) if not superuser, add some more superuser checks
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 12 Mar 2011 14:52:27 +0100
parents c084c1369078
children e4c332436733
rev   line source
92
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
1 # Copyright: 2007-2011 MoinMoin:ThomasWaldmann
26
4cd8edde9e94 automatically transform module docstrings, moving legal stuff to comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 24
diff changeset
2 # Copyright: 2001-2003 Juergen Hermann <jh@web.de>
54
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
3 # Copyright: 2008 MoinMoin:JohannesBerg
91
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
4 # Copyright: 2009 MoinMoin:EugeneSyromyatnikov
26
4cd8edde9e94 automatically transform module docstrings, moving legal stuff to comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 24
diff changeset
5 # Copyright: 2010 MoinMoin:DiogenesAugusto
4cd8edde9e94 automatically transform module docstrings, moving legal stuff to comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 24
diff changeset
6 # Copyright: 2010 MoinMoin:ReimarBauer
4cd8edde9e94 automatically transform module docstrings, moving legal stuff to comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 24
diff changeset
7 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
4cd8edde9e94 automatically transform module docstrings, moving legal stuff to comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 24
diff changeset
8
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9 """
54
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
10 MoinMoin - admin views
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11
54
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
12 This shows the user interface for wiki admins.
26
4cd8edde9e94 automatically transform module docstrings, moving legal stuff to comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 24
diff changeset
13 """
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15
107
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
16 from flask import request, url_for, flash, redirect, abort
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17 from flask import current_app as app
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 from flask import flaskg
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 from MoinMoin.i18n import _, L_, N_
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 from MoinMoin.themes import render_template
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22 from MoinMoin.apps.admin import admin
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 from MoinMoin import user
94
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
24 from MoinMoin.storage.error import NoSuchRevisionError
102
c084c1369078 move metadata name constant defs to MoinMoin.config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 101
diff changeset
25 from MoinMoin.config import SIZE
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 @admin.route('/')
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 def index():
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 return render_template('admin/index.html', item_name="+admin")
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 @admin.route('/userbrowser')
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33 def userbrowser():
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34 """
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
35 User Account Browser
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
36 """
107
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
37 if not flaskg.user or not flaskg.user.isSuperUser():
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
38 abort(403)
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
39
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
40 groups = flaskg.groups
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
41 user_accounts = []
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
42 for uid in user.getUserList():
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
43 u = user.User(uid)
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
44 user_accounts.append(dict(
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
45 uid=uid,
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
46 name=u.name,
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
47 email=u.email,
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
48 disabled=u.disabled,
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
49 groups=[groupname for groupname in groups if u.name in groups[groupname]],
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
50 ))
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
51 return render_template('admin/userbrowser.html', user_accounts=user_accounts, item_name="+admin/Userbrowser")
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
52
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
53
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
54 @admin.route('/userprofile/<user_name>', methods=['GET', 'POST', ])
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
55 def userprofile(user_name):
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
56 """
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
57 Set values in user profile
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
58 """
107
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
59 if not flaskg.user or not flaskg.user.isSuperUser():
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
60 abort(403)
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
61
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
62 uid = user.getUserId(user_name)
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
63 u = user.User(uid)
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
64 if request.method == 'GET':
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
65 return _(u"User profile of %(username)s: %(email)r", username=user_name,
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
66 email=(u.email, u.disabled))
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
67
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
68 if request.method == 'POST':
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
69 key = request.form.get('key', '')
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
70 val = request.form.get('val', '')
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
71 ok = False
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
72 if hasattr(u, key):
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
73 ok = True
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
74 oldval = getattr(u, key)
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
75 if isinstance(oldval, bool):
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
76 val = bool(val)
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
77 elif isinstance(oldval, int):
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
78 val = int(val)
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
79 elif isinstance(oldval, unicode):
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
80 val = unicode(val)
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
81 else:
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
82 ok = False
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
83 if ok:
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
84 setattr(u, key, val)
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
85 theuser.save()
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
86 flash('%s.%s: %s -> %s' % (user_name, key, unicode(oldval), unicode(val), ), "info")
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
87 else:
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
88 flash('modifying %s.%s failed' % (user_name, key, ), "error")
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
89 return redirect(url_for('admin.userbrowser'))
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
90
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
91
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
92 @admin.route('/mail_recovery_token', methods=['GET', 'POST', ])
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
93 def mail_recovery_token():
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
94 """
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
95 Send user an email so he can reset his password.
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
96 """
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
97 flash("mail recovery token not implemented yet")
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
98 return redirect(url_for('admin.userbrowser'))
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
99
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
100
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
101 @admin.route('/sysitems_upgrade', methods=['GET', 'POST', ])
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
102 def sysitems_upgrade():
107
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
103 if not flaskg.user or not flaskg.user.isSuperUser():
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
104 abort(403)
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
105
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
106 from MoinMoin.storage.backends import upgrade_sysitems
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
107 from MoinMoin.storage.error import BackendError
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
108 if request.method == 'GET':
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
109 action = 'syspages_upgrade'
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
110 label = 'Upgrade System Pages'
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
111 return render_template('admin/sysitems_upgrade.html',
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
112 item_name="+admin/System items upgrade")
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
113 if request.method == 'POST':
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
114 xmlfile = request.files.get('xmlfile')
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
115 try:
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
116 upgrade_sysitems(xmlfile)
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
117 except BackendError, e:
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
118 flash(_('System items upgrade failed due to the following error: %(error)s.', error=e), 'error')
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
119 else:
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
120 flash(_('System items have been upgraded successfully!'))
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
121 return redirect(url_for('admin.index'))
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
122
54
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
123
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
124 from MoinMoin.config import default as defaultconfig
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
125
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
126 @admin.route('/wikiconfig', methods=['GET', ])
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
127 def wikiconfig():
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
128 if not flaskg.user or not flaskg.user.isSuperUser():
107
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
129 abort(403)
54
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
130
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
131 settings = {}
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
132 for groupname in defaultconfig.options:
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
133 heading, desc, opts = defaultconfig.options[groupname]
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
134 for name, default, description in opts:
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
135 name = groupname + '_' + name
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
136 if isinstance(default, defaultconfig.DefaultExpression):
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
137 default = default.value
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
138 settings[name] = default
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
139 for groupname in defaultconfig.options_no_group_name:
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
140 heading, desc, opts = defaultconfig.options_no_group_name[groupname]
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
141 for name, default, description in opts:
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
142 if isinstance(default, defaultconfig.DefaultExpression):
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
143 default = default.value
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
144 settings[name] = default
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
145
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
146 def iter_vnames(cfg):
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
147 dedup = {}
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
148 for name in cfg.__dict__:
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
149 dedup[name] = True
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
150 yield name, cfg.__dict__[name]
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
151 for cls in cfg.__class__.mro():
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
152 if cls == defaultconfig.ConfigFunctionality:
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
153 break
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
154 for name in cls.__dict__:
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
155 if not name in dedup:
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
156 dedup[name] = True
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
157 yield name, cls.__dict__[name]
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
158
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
159 found = []
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
160 for vname, value in iter_vnames(app.cfg):
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
161 if hasattr(defaultconfig.ConfigFunctionality, vname):
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
162 continue
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
163 if vname in settings and settings[vname] == value:
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
164 continue
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
165 found.append((vname, value))
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
166
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
167 found.sort()
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
168 return render_template('admin/wikiconfig.html',
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
169 item_name="+admin/wikiconfig",
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
170 found=found, settings=settings)
2d6a32f75c2d WikiConfig: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 26
diff changeset
171
55
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
172
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
173 @admin.route('/wikiconfighelp', methods=['GET', ])
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
174 def wikiconfighelp():
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
175 if not flaskg.user or not flaskg.user.isSuperUser():
107
1a047dcf791c admin views: use abort(403) if not superuser, add some more superuser checks
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 102
diff changeset
176 abort(403)
55
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
177
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
178 def format_default(default):
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
179 if isinstance(default, defaultconfig.DefaultExpression):
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
180 default_txt = default.text
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
181 else:
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
182 default_txt = '%r' % (default, )
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
183 if len(default_txt) > 30:
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
184 default_txt = '...'
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
185 return default_txt
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
186
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
187 groups = []
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
188 for groupname in defaultconfig.options:
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
189 heading, desc, opts = defaultconfig.options[groupname]
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
190 opts = sorted([(groupname + '_' + name, format_default(default), description)
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
191 for name, default, description in opts])
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
192 groups.append((heading, desc, opts))
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
193 for groupname in defaultconfig.options_no_group_name:
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
194 heading, desc, opts = defaultconfig.options_no_group_name[groupname]
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
195 opts = sorted([(name, format_default(default), description)
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
196 for name, default, description in opts])
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
197 groups.append((heading, desc, opts))
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
198 groups.sort()
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
199 return render_template('admin/wikiconfighelp.html',
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
200 item_name="+admin/wikiconfighelp",
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
201 groups=groups)
32b88d45d63c WikiConfigHelp: remove macro, create admin view
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 54
diff changeset
202
91
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
203
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
204 @admin.route('/highlighterhelp', methods=['GET', ])
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
205 def highlighterhelp():
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
206 """display a table with list of available Pygments lexers"""
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
207 import pygments.lexers
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
208 headings = [_('Lexer description'),
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
209 _('Lexer names'),
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
210 _('File patterns'),
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
211 _('Mimetypes'),
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
212 ]
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
213 lexers = pygments.lexers.get_all_lexers()
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
214 rows = sorted([[desc, ' '.join(names), ' '.join(patterns), ' '.join(mimetypes), ]
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
215 for desc, names, patterns, mimetypes in lexers])
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
216 return render_template('admin/highlighterhelp.html',
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
217 item_name="+admin/highlighterhelp",
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
218 headings=headings,
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
219 rows=rows)
2e0766600e8f admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 55
diff changeset
220
94
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
221
92
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
222 @admin.route('/interwikihelp', methods=['GET', ])
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
223 def interwikihelp():
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
224 """display a table with list of known interwiki names / urls"""
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
225 headings = [_('InterWiki name'),
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
226 _('URL'),
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
227 ]
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
228 rows = sorted(app.cfg.interwiki_map.items())
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
229 return render_template('admin/interwikihelp.html',
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
230 item_name="+admin/interwikihelp",
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
231 headings=headings,
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
232 rows=rows)
5ff01f07c67c admin/interwikihelp view (replaces InterWiki macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 91
diff changeset
233
94
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
234
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
235 @admin.route('/itemsize', methods=['GET', ])
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
236 def itemsize():
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
237 """display a table with item sizes"""
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
238 headings = [_('Size'),
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
239 _('Item name'),
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
240 ]
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
241 rows = []
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
242 for item in flaskg.storage.iteritems():
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
243 try:
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
244 rev = item.get_revision(-1)
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
245 except NoSuchRevisionError:
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
246 # XXX we currently also get user items, they have no revisions -
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
247 # but in the end, they should not be readable by the user anyways
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
248 continue
101
856945a6d936 simplify revision data size handling - just store it into metadata
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 94
diff changeset
249 rows.append((rev[SIZE], item.name))
94
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
250 rows = sorted(rows, reverse=True)
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
251 return render_template('admin/itemsize.html',
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
252 item_name="+admin/itemsize",
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
253 headings=headings,
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
254 rows=rows)
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
255
990fdbe2d52c admin/itemsize view (replaces PageSize macro)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 92
diff changeset
256