web/views/autoform.py
branchstable
changeset 6101 1aff7367a20c
parent 6017 5f6a60ea8544
child 6392 faee4c380e50
child 6394 eb9a5bd778bc
--- a/web/views/autoform.py	Wed Aug 11 18:11:32 2010 +0200
+++ b/web/views/autoform.py	Thu Aug 12 10:11:49 2010 +0200
@@ -952,6 +952,10 @@
 
     def etype_relation_field(etype, rtype, role='subject'):
         eschema = vreg.schema.eschema(etype)
-        return AutomaticEntityForm.field_by_name(rtype, role, eschema)
+        try:
+            return AutomaticEntityForm.field_by_name(rtype, role, eschema)
+        except f.FieldNotFound:
+            AutomaticEntityForm.error('field for %s %s may not be found in schema' % (rtype, role))
+            return None
 
     vreg.register_all(globals().values(), __name__)