changeset 2223:fa049fc66a75

added a query method to CompositeName class.
author Ashutosh Singla <ashu1461@gmail.com>
date Tue, 16 Jul 2013 06:44:41 +0530
parents 9683c53aa305
children ef06927aefa5
files MoinMoin/util/interwiki.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/util/interwiki.py	Tue Jul 16 06:17:20 2013 +0530
+++ b/MoinMoin/util/interwiki.py	Tue Jul 16 06:44:41 2013 +0530
@@ -154,6 +154,15 @@
     def __unicode__(self):
         return self.fullname
 
+    @property
+    def query(self):
+        """
+        returns a dict that can be used as a whoosh query
+        to lookup index documents matching this CompositeName
+        """
+        field = NAME_EXACT if not self.field else self.field
+        return {NAMESPACE: self.namespace, field: self.value}
+
 
 def split_fqname(url):
     """