I have one table in my mysql db with name "users" with this:
id - name - email
1 - luis - exam...@gmail.com
2 - steff - he...@gmail.com

the field email is unique in the DAL 
    Field('email', 'string', length=255, required=True, notnull=True, 
unique=True),
 

when i try to edit the form, I only change my name, but the email it's the 
same, ok perfect,
I send 2 parameters, name is diferent and email it's the same in this case 
in the bd.
id: 1, name: pepe, email: exam...@gmail.com

result = db(db.users.id == 
params["id"]).validate_and_update(**db.users._filter_fields(params)).as_dict()

i search the register with the id, perfect, but when "update the email" i 
got the error

<class 'gluon.contrib.pymysql.err.IntegrityError'> (1062, u"Duplicate entry 
' exam...@gmail.com' for key 'email_UNIQUE'")

because "exam...@gmail.com exist in the databases BUT IS THAT REGISTER 
WHERE IS THE SAME! and I PUT THE SAME!

maybe you reply if don't have change the register, delete the params and 
don't send to DAL and when change send it.
that's it's not a good practice, because when i really change the email get 
code innecesary. and I need detecte the change in front page, (ios, 
andriod, web, etc) 

now, how can i solved my problems? 

I have one solutions but i don't like:
search the register in DB, read the field email and is the same delete 
params and dont send to insert and it's diferente send.
BUT that generate one petition aditional to the server

summarized: I check manually the unique in db.

Please I need help, thx very much
note: I dont talk good the english.




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to