fix EditController._ordered_formparams method in case some mandatory relation isn't specified
If you have an HTML form which doesn't carry information about some mandatory
relation (maybe because this relation is set by a hook), you ends up with a
KeyError when the form is posted.
Using a get instead of subscription protocol fixes the problem.
Closes #5481617.
--- a/web/views/editcontroller.py Wed Jun 03 17:22:06 2015 +0200
+++ b/web/views/editcontroller.py Mon Apr 06 21:49:06 2015 +0200
@@ -161,7 +161,9 @@
# simultaneously edited, the current entity must be
# created before the target one
if rdef.cardinality[0 if role == 'subject' else 1] == '1':
- target_eid = values[param]
+ # use .get since param may be unspecified (though it will usually lead
+ # to a validation error later)
+ target_eid = values.get(param)
if target_eid in values_by_eid:
# add dependency from the target entity to the
# current one