equal
deleted
inserted
replaced
949 |
949 |
950 def registration_callback(vreg): |
950 def registration_callback(vreg): |
951 global etype_relation_field |
951 global etype_relation_field |
952 |
952 |
953 def etype_relation_field(etype, rtype, role='subject'): |
953 def etype_relation_field(etype, rtype, role='subject'): |
954 eschema = vreg.schema.eschema(etype) |
|
955 try: |
954 try: |
|
955 eschema = vreg.schema.eschema(etype) |
956 return AutomaticEntityForm.field_by_name(rtype, role, eschema) |
956 return AutomaticEntityForm.field_by_name(rtype, role, eschema) |
957 except f.FieldNotFound: |
957 except (KeyError, f.FieldNotFound): |
|
958 # catch KeyError raised when etype/rtype not found in schema |
958 AutomaticEntityForm.error('field for %s %s may not be found in schema' % (rtype, role)) |
959 AutomaticEntityForm.error('field for %s %s may not be found in schema' % (rtype, role)) |
959 return None |
960 return None |
960 |
961 |
961 vreg.register_all(globals().values(), __name__) |
962 vreg.register_all(globals().values(), __name__) |