--- a/selectors.py Mon Sep 21 18:00:28 2009 +0200
+++ b/selectors.py Mon Sep 21 18:02:21 2009 +0200
@@ -611,14 +611,14 @@
etype = req.form['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
+ 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['etypes'].etype_class(etype), req)
--- a/web/views/editforms.py Mon Sep 21 18:00:28 2009 +0200
+++ b/web/views/editforms.py Mon Sep 21 18:02:21 2009 +0200
@@ -326,11 +326,9 @@
def call(self, **kwargs):
"""creation view for an entity"""
+ # at this point we know etype is a valid entity type, thanks to our
+ # selector
etype = kwargs.pop('etype', self.req.form.get('etype'))
- try:
- 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()