[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - vocabularywidget.py:1.14

Fred L. Drake, Jr. fred@zope.com
Thu, 29 May 2003 16:23:17 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv16295

Modified Files:
	vocabularywidget.py 
Log Message:
be more careful about setting query_index


=== Zope3/src/zope/app/browser/form/vocabularywidget.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/browser/form/vocabularywidget.py:1.13	Thu May 29 15:33:51 2003
+++ Zope3/src/zope/app/browser/form/vocabularywidget.py	Thu May 29 16:23:16 2003
@@ -499,13 +499,15 @@
         #
         get = self.request.form.get
         self.action = self.getAction()
-        try:
-            self.query_index = int(get(self.query_index_name, 0))
-        except ValueError:
-            self.query_index = None
-        else:
-            if self.query_index < 0:
-                self.query_index = None
+        self.query_index = None
+        if self.query_index_name in self.request.form:
+            try:
+                index = int(self.request.form[self.query_index_name])
+            except ValueError:
+                pass
+            else:
+                if index >= 0:
+                    self.query_index = index
         QS = get(self.query_selections_name, [])
         if not isinstance(QS, list):
             QS = [QS]