117 if '__maineid' in form: |
117 if '__maineid' in form: |
118 req.set_shared_data('__maineid', form['__maineid'], txdata=True) |
118 req.set_shared_data('__maineid', form['__maineid'], txdata=True) |
119 # no specific action, generic edition |
119 # no specific action, generic edition |
120 self._to_create = req.data['eidmap'] = {} |
120 self._to_create = req.data['eidmap'] = {} |
121 self._pending_fields = req.data['pendingfields'] = set() |
121 self._pending_fields = req.data['pendingfields'] = set() |
122 try: |
|
123 methodname = req.form.pop('__method', None) |
|
124 for eid in req.edited_eids(): |
|
125 # __type and eid |
|
126 formparams = req.extract_entity_params(eid, minparams=2) |
|
127 if methodname is not None: |
|
128 entity = req.entity_from_eid(eid) |
|
129 method = getattr(entity, methodname) |
|
130 method(formparams) |
|
131 eid = self.edit_entity(formparams) |
|
132 except (RequestError, NothingToEdit), ex: |
|
133 if '__linkto' in req.form and 'eid' in req.form: |
|
134 self.execute_linkto() |
|
135 elif not ('__delete' in req.form or '__insert' in req.form): |
|
136 raise ValidationError(None, {None: unicode(ex)}) |
|
137 # handle relations in newly created entities |
122 # handle relations in newly created entities |
138 if self._pending_fields: |
123 if self._pending_fields: |
139 for form, field in self._pending_fields: |
124 for form, field in self._pending_fields: |
140 self.handle_formfield(form, field) |
125 self.handle_formfield(form, field) |
141 # execute rql to set all relations |
126 # execute rql to set all relations |