changeset 4929:c4ee81d47889

include only necessary browser autofilter options If there are no empty fields, it's not necessary to show the [empty] and [not empty] special autofilter items since [not empty] will be equivalent to [all] and [empty] will never match anything.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 27 Jul 2009 12:46:39 +0200
parents 3c7e2e535d67
children de0f87166f1c 43c468a525ef
files MoinMoin/widget/browser.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/widget/browser.py	Sat Jul 25 12:38:25 2009 +0200
+++ b/MoinMoin/widget/browser.py	Mon Jul 27 12:46:39 2009 +0200
@@ -89,10 +89,13 @@
         del unique[0]
         unique.sort()
         result = [self._makeoption(item, item == value) for item in unique]
-        common = [None, None, None]
-        common[0] = self._makeoption(self._all, value == self.__all, self.__all)
-        common[1] = self._makeoption(self._empty, value == self.__empty, self.__empty)
-        common[2] = self._makeoption(self._notempty, value == self.__notempty, self.__notempty)
+        common = []
+        common.append(self._makeoption(self._all, value == self.__all, self.__all))
+        if '' in unique:
+            common.extend([
+                self._makeoption(self._empty, value == self.__empty, self.__empty),
+                self._makeoption(self._notempty, value == self.__notempty, self.__notempty),
+            ])
         return '\n'.join(common + result)
 
     def _format(self, formatter=None, method=None):