When an error occurs with a form submission, the form should be 
re-displayed with an error message attached to the field that caused the 
error. Where is the error being displayed? I notice you have  
db.auth_user.registration_id.requires = IS_NOT_IN_DB(...). If the 
registration_id field is left empty, that would cause the error in 
question. Note, I don't think you need that validator for the 
registration_id field (it is not included in the standard auth_user table 
definition in Auth). Try removing that line.

Anthony 

On Wednesday, January 4, 2012 11:13:53 AM UTC-5, OpenMercury wrote:
>
> I get it on any field.  As soon as I hit submit, I get that error and 
> no updating takes place. 
> Here is my model db.py: 
>
> from gluon.tools import Auth, Crud, Service, PluginManager, prettydate 
> auth = Auth(db, hmac_key=Auth.get_or_create_key()) 
> crud, service, plugins = Crud(db), Service(), PluginManager() 
>
> ## create all tables needed by auth if not custom tables 
>
> ######################################## 
> db.define_table('auth_user', 
>     Field('username', type='string', 
>           label=T('Username')), 
>     Field('first_name', type='string', 
>           label=T('First Name')), 
>     Field('last_name', type='string', 
>           label=T('Last Name')), 
>     Field('email', type='string', 
>           label=T('Email')), 
>     Field('password', type='password', 
>           readable=False, 
>           label=T('Password')), 
>     Field('created_on','datetime',default=request.now, 
>           label=T('Created On'),writable=False,readable=False), 
>     Field('modified_on','datetime',default=request.now, 
>           label=T('Modified On'),writable=False,readable=False, 
>           update=request.now), 
>     Field('registration_key',default='', 
>           writable=True,readable=False), 
>     Field('reset_password_key',default='', 
>           writable=False,readable=False), 
>     Field('registration_id',default='', 
>           writable=False,readable=False), 
>     format='%(username)s', 
>     migrate=settings.migrate) 
>
>
> db.auth_user.first_name.requires = 
> IS_NOT_EMPTY(error_message=auth.messages.is_empty) 
> db.auth_user.last_name.requires = 
> IS_NOT_EMPTY(error_message=auth.messages.is_empty) 
> db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key) 
> db.auth_user.username.requires = IS_NOT_IN_DB(db, 
> db.auth_user.username) 
> db.auth_user.registration_id.requires = IS_NOT_IN_DB(db, 
> db.auth_user.registration_id) 
> db.auth_user.email.requires = 
> (IS_EMAIL(error_message=auth.messages.invalid_email), 
>                                IS_NOT_IN_DB(db, db.auth_user.email)) 
> auth.define_tables(migrate = settings.migrate) 
>
>
> On Jan 4, 9:27 am, Anthony <abas...@gmail.com> wrote: 
> > I cannot reproduce this problem. Do you get the "value already in 
> database 
> > or empty" message specifically on the registration_key field, or on the 
> > email or username field? Have you set any validators for 
> > db.auth_user.registration_key (you can check by printing 
> > db.auth_user.registration_key.requires)? 
> > 
> > Anthony 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Wednesday, January 4, 2012 8:48:29 AM UTC-5, OpenMercury wrote: 
> > 
> > > Hi, 
> > 
> > > I'm using the basic scaffolding app and have set it up so new users 
> > > need to be approved to use the application. 
> > > I'm registered and there is an entry in auth_user table.  The 
> > > registration key field value is 'Pending'.  From reading the docs, all 
> > > I should have to do is blank out the registration key field.  I'm 
> > > trying to do that via appAdmin and editing the current record.  When I 
> > > blank out registration key field and hit 'submit' I get the message 
> > >         "value already in database or empty".  What am I doing wrong 
> or is 
> > > this a bug? 
> > 
> > > Thanks Scott

Reply via email to