web/views/autoform.py
branchstable
changeset 6392 faee4c380e50
parent 6101 1aff7367a20c
child 6401 d7f5d873e1b8
--- 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