changeset 1731:025bf5e65246

fixes issue 148, crash on similar names when wiki has no items
author Roger Haase <crosseyedpenguin@yahoo.com>
date Thu, 23 Aug 2012 13:04:53 -0700
parents 9a0b6e93fb3c
children 8717df0c789c
files MoinMoin/apps/frontend/views.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Wed Aug 22 00:06:55 2012 +0200
+++ b/MoinMoin/apps/frontend/views.py	Thu Aug 23 13:04:53 2012 -0700
@@ -1776,6 +1776,8 @@
     :rtype: list
     :returns: list of matching item names, sorted by rank
     """
+    if not item_names:
+        return []
     # Match using case insensitive matching
     # Make mapping from lower item names to item names.
     lower = {}
@@ -1788,7 +1790,7 @@
 
     # Get all close matches
     all_matches = difflib.get_close_matches(item_name.lower(), lower.keys(),
-                                            len(lower), cutoff=0.6)
+                                            n=len(lower), cutoff=0.6)
 
     # Replace lower names with original names
     matches = []