[Checkins] SVN: z3c.formwidget.query/branches/do3cc_dont_fail_on_missing_terms/src/z3c/formwidget/query/widget.py Ignore terms that do not exist any longer

Patrick Gerken do3ccqrv at gmail.com
Mon Jul 5 06:47:40 EDT 2010


Log message for revision 114199:
  Ignore terms that do not exist any longer

Changed:
  U   z3c.formwidget.query/branches/do3cc_dont_fail_on_missing_terms/src/z3c/formwidget/query/widget.py

-=-
Modified: z3c.formwidget.query/branches/do3cc_dont_fail_on_missing_terms/src/z3c/formwidget/query/widget.py
===================================================================
--- z3c.formwidget.query/branches/do3cc_dont_fail_on_missing_terms/src/z3c/formwidget/query/widget.py	2010-07-05 10:43:12 UTC (rev 114198)
+++ z3c.formwidget.query/branches/do3cc_dont_fail_on_missing_terms/src/z3c/formwidget/query/widget.py	2010-07-05 10:47:40 UTC (rev 114199)
@@ -121,8 +121,15 @@
                 selection = []
             elif not isinstance(selection, (tuple, set, list)):
                 selection = [selection]
-            
-            terms = set([source.getTerm(value) for value in selection if value])
+            terms = []
+            for value in selection:
+                if not value:
+                    continue
+                try:
+                    terms.append(source.getTerm(value))
+                except LookupError:
+                    continue
+            terms = set(terms)
 
         # Set up query form
 



More information about the checkins mailing list