selectors.py
changeset 2293 7ded2a1416e4
parent 2181 94ca417b9b07
parent 2274 885873dc4361
child 2381 caad2367d940
--- a/selectors.py	Thu Jul 02 10:36:25 2009 +0200
+++ b/selectors.py	Mon Jul 06 19:55:18 2009 +0200
@@ -482,8 +482,7 @@
     def __call__(self, cls, req, *args, **kwargs):
         score = 0
         for param in self.expected:
-            val = req.form.get(param)
-            if not val:
+            if not param in req.form:
                 return 0
             score += 1
         return len(self.expected)
@@ -623,6 +622,14 @@
                 etype = kwargs['etype']
             except KeyError:
                 return 0
+        else:
+            # only check this is a known type if etype comes from req.form,
+            # else we want the error to propagate
+            try:
+                etype = cls.vreg.case_insensitive_etypes[etype.lower()]
+                req.form['etype'] = etype
+            except KeyError:
+                return 0
         return self.score_class(cls.vreg.etype_class(etype), req)