changeset 796:a24b6f389ab1 pytest2

whooshify backrefs
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 29 Aug 2011 15:31:00 +0200
parents 2d844c1a3ab2
children 31aff629ed47
files MoinMoin/apps/frontend/views.py
diffstat 1 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Mon Aug 29 14:51:38 2011 +0200
+++ b/MoinMoin/apps/frontend/views.py	Mon Aug 29 15:31:00 2011 +0200
@@ -662,18 +662,12 @@
     :returns: the list of all items which ref item_name
     """
     refs_here = []
-    for item in items:
-        current_item = item.name
-        try:
-            current_revision = item.get_revision(-1)
-        except NoSuchRevisionError:
-            continue
-        links = current_revision.get(ITEMLINKS, [])
-        transclusions = current_revision.get(ITEMTRANSCLUSIONS, [])
-
-        refs = set(links + transclusions)
-        if item_name in refs:
-            refs_here.append(current_item)
+    docs = flaskg.storage.documents(all_revs=False, wikiname=app.cfg.interwikiname)
+    for doc in docs:
+        if (item_name in doc.get(ITEMLINKS, [])
+            or
+            item_name in doc.get(ITEMTRANSCLUSIONS, [])):
+            refs_here.append(doc[NAME])
     return refs_here