[forms] catching KeyError closes #961831: migration failure when defining form fields
--- a/web/views/autoform.py Mon Oct 04 15:55:55 2010 +0200
+++ b/web/views/autoform.py Mon Oct 04 19:05:51 2010 +0200
@@ -951,10 +951,11 @@
global etype_relation_field
def etype_relation_field(etype, rtype, role='subject'):
- eschema = vreg.schema.eschema(etype)
try:
+ eschema = vreg.schema.eschema(etype)
return AutomaticEntityForm.field_by_name(rtype, role, eschema)
- except f.FieldNotFound:
+ except (KeyError, f.FieldNotFound):
+ # catch KeyError raised when etype/rtype not found in schema
AutomaticEntityForm.error('field for %s %s may not be found in schema' % (rtype, role))
return None