use case_insensitive_etypes to normalize entity types coming from req.form stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 06 Jul 2009 11:01:41 +0200
branchstable
changeset 2274 885873dc4361
parent 2273 daf6e178659f
child 2275 bc0bed0616a3
child 2281 3b2c1d55090a
use case_insensitive_etypes to normalize entity types coming from req.form
selectors.py
--- a/selectors.py	Mon Jul 06 10:56:43 2009 +0200
+++ b/selectors.py	Mon Jul 06 11:01:41 2009 +0200
@@ -622,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)