case insensitive add/XXX url stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 01 Sep 2009 17:58:29 +0200
branchstable
changeset 3077 6c92323667a6
parent 3074 141cfaac6b97
child 3078 186ccbe0ba3f
case insensitive add/XXX url
web/views/editforms.py
--- a/web/views/editforms.py	Tue Sep 01 17:25:00 2009 +0200
+++ b/web/views/editforms.py	Tue Sep 01 17:58:29 2009 +0200
@@ -327,13 +327,13 @@
         """creation view for an entity"""
         etype = kwargs.pop('etype', self.req.form.get('etype'))
         try:
-            entity = self.vreg['etypes'].etype_class(etype)(self.req)
-        except:
-            self.w(self.req._('no such entity type %s') % etype)
-        else:
-            self.initialize_varmaker()
-            entity.eid = self.varmaker.next()
-            self.render_form(entity)
+            etype = self.vreg.case_insensitive_etypes[etype.lower()]
+        except KeyError:
+            raise RequestError(self.req._('no such entity type %s') % etype)
+        entity = self.vreg['etypes'].etype_class(etype)(self.req)
+        self.initialize_varmaker()
+        entity.eid = self.varmaker.next()
+        self.render_form(entity)
 
     def form_title(self, entity):
         """the form view title"""