changeset 2246:f6fa7658535e

Added Multiple name and namespace support for tags view.
author Ashutosh Singla <ashu1461@gmail.com>
date Tue, 20 Aug 2013 19:39:23 +0530
parents 555d74396ece
children 3f532c2cac83
files MoinMoin/apps/frontend/views.py
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Sun Aug 18 16:17:58 2013 +0530
+++ b/MoinMoin/apps/frontend/views.py	Tue Aug 20 19:39:23 2013 +0530
@@ -1995,18 +1995,23 @@
                            tags=tags)
 
 
-@frontend.route('/+tags/<itemname:tag>')
-def tagged_items(tag):
+@frontend.route('/+tags/<itemname:tag>', defaults=dict(namespace=NAMESPACE_DEFAULT), methods=['GET'])
+@frontend.route('/<namespace>/+tags/<itemname:tag>')
+def tagged_items(tag, namespace):
     """
-    show all items' names that have tag <tag>
+    show all items' names that have tag <tag> and belong to namespace <namespace>
     """
     query = And([Term(WIKINAME, app.cfg.interwikiname), Term(TAGS, tag), ])
-    revs = flaskg.storage.search(query, sortedby=NAME_EXACT, limit=None)
-    item_names = [rev.name for rev in revs]
+    if not namespace == NAMESPACE_ALL:
+        query = And([query, Term(NAMESPACE, namespace), ])
+    revs = flaskg.storage.search(query, limit=None)
+    fq_names = []
+    for rev in revs:
+        fq_names += rev.fqnames
     return render_template("link_list_no_item_panel.html",
                            headline=_("Items tagged with %(tag)s", tag=tag),
                            item_name=tag,
-                           item_names=item_names)
+                           fq_names=fq_names)
 
 
 @frontend.route('/+template/<path:filename>')