I´m testing this book example
http://web2py.com/books/default/chapter/29/07#onvalidation
I get error on field named 'a'


Traceback (most recent call last):
  File "C:\web2pyGit\web2py\gluon\restricted.py", line 212, in restricted

    exec ccode in environment
  File "C:/web2pyGit/web2py/applications/teste1/models/db.py"
<http://127.0.0.1:8000/admin/default/edit/teste1/models/db.py>, line
91, in <module>

    Field('c', 'integer', readable=False, writable=False))

  File "C:\web2pyGit\web2py\gluon\dal.py", line 7189, in define_table

    table = self.lazy_define_table(tablename,*fields,**args)

  File "C:\web2pyGit\web2py\gluon\dal.py", line 7206, in lazy_define_table

    table = table_class(self, tablename, *fields, **args)

  File "C:\web2pyGit\web2py\gluon\dal.py", line 7612, in __init__

    db.check_reserved_keyword(field_name)

  File "C:\web2pyGit\web2py\gluon\dal.py", line 6933, in check_reserved_keyword

    'invalid table/column name "%s" is a "%s" reserved SQL keyword' %
(name, backend.upper()))
SyntaxError: invalid table/column name "a" is a "ALL" reserved SQL keyword


So i renamed all to a1,b1,c1 and it works !

Now my initial complain is still not working. I will test tomorrow and post
some code.
Meanwhile please check why a is not a valid field name and update the book
if necessary.
thank you

2013/1/15 Anthony <abasta...@gmail.com>

> form.vars should work. Can you show more code? Note, form.request_vars is
> simply a copy of the original request.post_vars, so not equivalent to
> form.vars.
>
> Anthony
>
>
> On Tuesday, January 15, 2013 10:17:08 AM UTC-5, Ramos wrote:
>>
>> hello reading the book online i tried the code
>>
>>
>> def my_form_processing(form):
>>     c = form.vars.a
>>
>>     form.vars.b
>>     if c < 0:
>>         form.errors.b = 'a'
>>     else:
>>         form.vars.c = c
>>
>>
>>
>> but form.vars was empty
>>
>> to access my form vars i changed to form.request_vars
>>
>> *Is the book wrong?*
>>
>> Thank you
>> António
>>
>  --
>
>
>
>

-- 



Reply via email to