Re: Custom type is missing id_schema in reg_form
from
Ross Patterson
on Dec 14, 2006 05:54 PM
Rob Miller <robm@...> writes:
> the other suspicious looking piece is the following, from your member
> definition module:
>
>
> # Lifted from Products.remember.content.member
> # This seems rather magic!
> metadata_schema = ExtensibleMetadata.schema.copy()
> # Establish the field order
> full_wimax_member_schema = wimax_member_schema + metadata_schema
> # metadata_schema doesn't override any fields in content_schema
> full_wimax_member_schema = full_wimax_member_schema + wimax_member_schema
>
>
> that strikes me as very odd... essentially what you're saying is:
>
> full_wimax_member_schema = wimax_member_schema + metadata_schema_ +
> wimax_member_schema
>
> your comment implies that it was lifted from remember itself, though.
> i checked, and sure enough remember does something very similar:
>
> http://dev.plone.org/collective/changeset/30301
>
> rossp, are you out there? can you explain what the purpose of that
> change was? it definitely strikes me as odd.
Here's the issue. Schema addition (+) preserves the order of the
*first* schema, but overrides any field in the first schema with any
fields of the same name in the second schema. So first we
"content_schema + metadata_schema" to get the order right, then we
"member_schema + content_schema" again to make sure that
content_schema wins for any fields of the same name in both
content_schema and metadata_schema.
This help?
Ross