changeset 2249:cbac7d3a33c7

Added namespace support to trash view.
author Ashutosh Singla <ashu1461@gmail.com>
date Tue, 20 Aug 2013 20:15:28 +0530
parents 254b7d085447
children eb0525763040
files MoinMoin/apps/frontend/views.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Tue Aug 20 20:06:12 2013 +0530
+++ b/MoinMoin/apps/frontend/views.py	Tue Aug 20 20:15:28 2013 +0530
@@ -829,20 +829,23 @@
     )
 
 
-@frontend.route('/+trash')
-def trash():
+@frontend.route('/+trash', defaults=dict(namespace=NAMESPACE_DEFAULT), methods=['GET'])
+@frontend.route('/<namespace>/+trash')
+def trash(namespace):
     """
     Returns the trashed items.
     """
-    trash = _trashed()
+    trash = _trashed(namespace)
     return render_template('trash.html',
                            headline=_(u'Trashed Items'),
                            title_name=_(u'Trashed Items'),
                            results=trash)
 
 
-def _trashed():
+def _trashed(namespace):
     q = And([Term(WIKINAME, app.cfg.interwikiname), Term(TRASH, True)])
+    if not namespace == NAMESPACE_ALL:
+        q = And([q, Term(NAMESPACE, namespace), ])
     trashedEntry = namedtuple('trashedEntry', 'fqname oldname revid mtime comment editor')
     results = []
     for rev in flaskg.storage.search(q, limit=None):