Re: Overriding the id/username generation
from
rossp
on May 31, 2009 11:17 PM
Tim Knapp <duffyd@...> writes:
> On Sun, 2009-05-31 at 18:04 -0700, Ross Patterson wrote:
>> Tim Knapp <duffyd@...> writes:
>>
>> > As I'm using betahaus.emaillogin[1] in my application I'm wanting to
>> > override the generation of the username as this is a little confusing
>> > for users as they expect to login with their email address but we're
>> > still asking them to enter a username.
>> >
>> > I've tried to override this as follows in my member schema:
>> >
>> > # Overriding the id field as we're using betahaus.emaillogin
>> > atapi.ComputedField('id',
>> > expression = "context.setId()",
>> >
>> > index=('membrane_tool/ZCTextIndex,lexicon_id=member_lexicon,index_type=Cosine Measure|TextIndex:brains',
>> > 'FieldIndex:brains'),
>> > widget=atapi.ComputedWidget(label='User name'),
>> > regfield=0,
>> > user_property=True,
>> > ),
>>
>> Thus far I don't think I'm understanding the intention of certain
>> choices in your implementation enough to comment. Why use the "setId"
>> method? Wouldn't overriding that wreak all sorts of havoc with the fact
>> that membrane members are OFS objects?
>
> Ok, lets start with an overview. betahaus.emaillogin[1] circumvents the
> need for a username as it cycles through the members in your site and
> authenticates against their email address hence if I also prompt members
> for a username when they register with the site its confusing for them
> as they wonder "huh, why do I need to enter a username if the system is
> going to authenticate against my email address?".
>
> Now what you say re. overriding the setId method may very well be the
> case and a bad design choice hence my emailing the list.
Well, I still want to know you're thinking behind using it as a starting
point for any help.
>> > When I run my functional test, though, it doesn't create the user and
>> > doesn't even enter the setId method (as you can see I've got a pdb in
>> > there). Its supposed to return 'You have been registered as a member.'
>> > but instead I get 'Changes saved.' as a status message.
>>
>> Care to include the test or at least some snippets from it?
>
> Its a functional test (i.e. what the user sees when using the site) so
> so it won't illuminate you on my usecase. IOW it just shows the user
> register with the site (enter values and click 'register).
But being able to see it would allow me to answer a bunch of questions
for myself without having to spend as much time writing emails for each
question as I think of them. For example, is this a browser test or are
you using some of the python registration "API"s. Which ones? What's
the test fixture? Etc..
Ross