--- a/web/views/editforms.py Wed Sep 02 10:22:47 2009 +0200
+++ b/web/views/editforms.py Wed Sep 02 10:24:15 2009 +0200
@@ -20,7 +20,8 @@
from cubicweb.utils import make_uid
from cubicweb.view import EntityView
from cubicweb.common import tags
-from cubicweb.web import INTERNAL_FIELD_VALUE, stdmsgs, eid_param, uicfg
+from cubicweb.web import INTERNAL_FIELD_VALUE, RequestError, stdmsgs, eid_param
+from cubicweb.web import uicfg
from cubicweb.web.form import FormViewMixIn, FieldNotFound
from cubicweb.web.formfields import guess_field
from cubicweb.web.formwidgets import Button, SubmitButton, ResetButton
@@ -327,13 +328,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"""