Register, confirm password, another backwards compatibility bug?

62 views
Skip to first unread message

Leonel Câmara

unread,
Sep 26, 2014, 2:57:13 PM9/26/14
to web2py-d...@googlegroups.com
I'm getting the confirm password row after my auth_user extra_fields instead of right after the password where it should be.

I get that it's putting the settings.register_fields first which are None so it has all the auth_user table fields, these go as fields in the SQLFORM, confirm_password goes as an extra_field. extra_fields are appended to the fields so naturally confirm_password comes out last.

This isn't the expected behaviour at all. Register should place confirm_password after the password field.

This forces me to do this in my view:

    confirm = form[0][-2]
    del form[0][-2]
    form[0].insert(4, confirm)


Which I wouldn't call exactly intuitive. This wasn't the behaviour that happened before btw, when password_two was not placed in the form using extra_fields (it was placed using addrow).

This also led me to check tools.py addrow looking for a fix to this problem, addrow however seems to be missing some formstyles namely boostrap3_stacked and bootstrap3_inline.

Which goes to show that addrow should probably be part of the formstyle definition instead of a function in tools.py otherwise people are bound to forget about it. This is possible BTW since formstyles can now be any callable we could just make them to be classes that have their own addrow.


Suggestions?

Niphlod

unread,
Sep 29, 2014, 6:14:24 PM9/29/14
to web2py-d...@googlegroups.com
+1. on top of grid and smartgrid lots of tools.py code could/should be refactored.

BTW: does anyone really recall the reason behind extra_fields that introduced this and another "backward compatibility issue" ?
Reply all
Reply to author
Forward
0 new messages