Thank you, problem was generator GENID_ABIT_VALIDATION_CODES is not defined.
I changed:
db_xml.abit_validation_codes.insert(A_EMAIL=email,V_CODE=validCode)
on:
db_xml.executesql("""INSERT INTO abit_validation_codes (A_EMAIL,V_CODE) 
VALUES ('{0}','{1}') RETURNING id""".format(email,validCode))
and all work!

Maybe, you take advice here 
<https://groups.google.com/forum/#!topic/web2py/El8rlp_YrMY>.



четверг, 2 августа 2018 г., 16:21:11 UTC+3 пользователь Anthony написал:
>
> Remove the try/except, and when you get the error, go to admin and view 
> the error ticket -- report here with the traceback. Also, show the database 
> model.
>
> Anthony
>
> On Thursday, August 2, 2018 at 9:09:36 AM UTC-4, Константин Комков wrote:
>>
>> I don't understand why the variable "CodeInDB" == False.
>> Controller:
>> def VcodeToDbAndMail():
>>     form = SQLFORM(db_app.post)
>>     if form.accepts(request, formname=None):
>>         email=request.vars.email.strip()
>>         validCode = random.randint(1000000,9999999)
>>         CodeInDB = True
>>         try:
>>             
>> db_xml.abit_validation_codes.insert(A_EMAIL=email,V_CODE=validCode)
>>             db_xml.commit()
>>         except Exception:
>>             CodeInDB = False
>>         return XML("<div>"+str(CodeInDB)+"</div>")
>>     elif form.errors:
>>         return TABLE(*[TR(k, v) for k, v in form.errors.items()])
>> >> False
>>
>> In DataBase I saw new record with my email and code.
>> If I do it witout "try ... except ...", I have error: "An error occured, 
>> please reload the page".
>>
>>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to