• Remember Mailing List

Re: Custom type is missing id_schema in reg_form

from Rob Miller on Dec 14, 2006 01:39 PM
Tim Hicks wrote:
> Rob Miller wrote:
>> Tim Hicks wrote:
>>> Hi,
>>>
>>> I've got a product that defines a custom remember-ish member type.  The
>>> schema for this type uses
>>> Products.remember.context.member_schema.id_schema as (the first) part of
>>> its schema, along with some custom schema elements capturing extra
>>> address information, etc.
>>>
>>> When I register my type as the default member type in the configlet and
>>> then visit the join_form (aka reg_form), strangely the id_schema fields
>>> do not get shown, while the fields from the custom part of my schema do.
>>>
>>> My type is registered to use member_auto_workflow (as rob suggested on
>>> irc).  So I don't think it's a permissions issue (which I was facing
>>> before).
>>>
>>> Does anyone have any idea why the 'username' field isn't getting
>>> displayed?
>> not w/o more info.  maybe you can post your schema definition?  or,
>> better yet, point us to a code repo where we can look at it, and how
>> it's woven into your class?
> 
> I'm afraid it's in a private repo, so I've pasted to somewhere
> temporary.  See <http://paste.plone.org/12090> for my schema definition
> and <http://paste.plone.org/12091> for my member class.

this helps, thanks.

the first thing i notice is that you're importing the schema parts from 
remember's member schema, but you're not copying them.  it's generally a good 
idea to do "schema.copy()" on an imported schema before using it, to ensure 
that you've got a completely separate entity from the originally imported 
schema, and don't inadvertently monkey-patch the base class.

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.

-r
Return to date view: threaded or flat