web/views/autoform.py
changeset 6401 d7f5d873e1b8
parent 6394 eb9a5bd778bc
parent 6392 faee4c380e50
child 6427 c8a5ac2d1eaa
--- a/web/views/autoform.py	Wed Oct 06 11:57:21 2010 +0200
+++ b/web/views/autoform.py	Wed Oct 06 14:04:26 2010 +0200
@@ -941,10 +941,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