213 # -> use a simple onload js function to check if there is |
213 # -> use a simple onload js function to check if there is |
214 # a input type=file in the form |
214 # a input type=file in the form |
215 # -> generate the <form> node when the content is rendered |
215 # -> generate the <form> node when the content is rendered |
216 # and we know the correct enctype (formrenderer's w attribute |
216 # and we know the correct enctype (formrenderer's w attribute |
217 # is not a StringIO) |
217 # is not a StringIO) |
218 for rschema, targettypes, role in self.inlined_relations(): |
218 for formview in self.inlined_form_views(): |
219 # inlined forms don't handle multiple target types |
219 if formview.form: |
220 if len(targettypes) != 1: |
220 if hasattr(formview.form, '_subform_needs_multipart'): |
221 continue |
221 needs_multipart = formview.form._subform_needs_multipart(_tested) |
222 targettype = targettypes[0] |
|
223 if targettype in _tested: |
|
224 continue |
|
225 _tested.add(targettype) |
|
226 if self.should_inline_relation_form(rschema, targettype, role): |
|
227 entity = self.vreg['etypes'].etype_class(targettype)(self.req) |
|
228 subform = self.vreg['forms'].select('edition', self.req, entity=entity) |
|
229 if hasattr(subform, '_subform_needs_multipart'): |
|
230 needs_multipart = subform._subform_needs_multipart(_tested) |
|
231 else: |
222 else: |
232 needs_multipart = subform.form_needs_multipart |
223 needs_multipart = formview.form.form_needs_multipart |
233 if needs_multipart: |
224 if needs_multipart: |
234 return True |
225 return True |
235 return False |
226 return False |
236 |
227 |
237 def action(self): |
228 def action(self): |