1 # GNU MediaGoblin -- federated, autonomous media hosting
2 # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Affero General Public License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 from mediagoblin
.db
.util
import DESCENDING
18 from mediagoblin
.decorators
import require_active_login
19 from mediagoblin
.tools
.response
import (render_to_response
, render_403
,
23 def admin_processing_panel(request
):
25 Show the global processing panel for this instance
27 # TODO: Why not a "require_admin_login" decorator throwing a 403 exception?
28 if not request
.user
.is_admin
:
29 return render_403(request
)
31 processing_entries
= request
.db
.MediaEntry
.find(
32 {'state': u
'processing'}).sort('created', DESCENDING
)
34 # Get media entries which have failed to process
35 failed_entries
= request
.db
.MediaEntry
.find(
36 {'state': u
'failed'}).sort('created', DESCENDING
)
38 processed_entries
= request
.db
.MediaEntry
.find(
39 {'state': u
'processed'}).sort('created', DESCENDING
).limit(10)
42 return render_to_response(
44 'mediagoblin/admin/panel.html',
45 {'processing_entries': processing_entries
,
46 'failed_entries': failed_entries
,
47 'processed_entries': processed_entries
})