# HG changeset patch # User Sylvain Thénault # Date 1260446125 -3600 # Node ID de31c3afe97571f27545e49a6a71d01176307ba0 # Parent 7e478d7caf20d0c6d61413f0b16d8d1b045af16b fix 3.6 bug diff -r 7e478d7caf20 -r de31c3afe975 web/views/autoform.py --- a/web/views/autoform.py Thu Dec 10 11:57:07 2009 +0100 +++ b/web/views/autoform.py Thu Dec 10 12:55:25 2009 +0100 @@ -59,9 +59,9 @@ try: return super(AutomaticEntityForm, cls_or_self).field_by_name(name, role) except form.FieldNotFound: - if eschema is None or not name in cls_or_self._cw.vreg.schema: + if eschema is None or not name in eschema.schema: raise - rschema = cls_or_self._cw.vreg.schema.rschema(name) + rschema = eschema.schema.rschema(name) # XXX use a sample target type. Document this. tschemas = rschema.targets(eschema, role) fieldcls = cls_or_self.rfields.etype_get(eschema, rschema, role, @@ -352,11 +352,6 @@ peid=self.edited_entity.eid, pform=self) -def etype_relation_field(etype, rtype, role='subject'): - eschema = AutomaticEntityForm.schema.eschema(etype) - return AutomaticEntityForm.field_by_name(rtype, role, eschema) - - ## default form ui configuration ############################################## _afs = uicfg.autoform_section @@ -406,3 +401,10 @@ {'widget': fwdgs.TextInput}) uicfg.autoform_field_kwargs.tag_subject_of(('TrInfo', 'wf_info_for', '*'), {'widget': fwdgs.HiddenInput}) + +def registration_callback(vreg): + global etype_relation_field + + def etype_relation_field(etype, rtype, role='subject'): + eschema = vreg.schema.eschema(etype) + return AutomaticEntityForm.field_by_name(rtype, role, eschema)