OperationalError always originate from the database. "from" is not a
valid field name for you database.

On 14 Lug, 03:42, elffikk <elff...@gmail.com> wrote:
> I am getting such an error in last release of web2py, with previews
> versions didn't try
>
> Traceback (most recent call last):
>   File "...\web2py\gluon\restricted.py", line 178, in restricted
>     exec ccode in environment
>   File ".../web2py/applications/mailtest/models/models.py", line 7, in
> <module>
>     Field("body", "text")
>   File "...\web2py\gluon\sql.py", line 1309, in define_table
>     t._create(migrate=migrate, fake_migrate=fake_migrate)
>   File "...\web2py\gluon\sql.py", line 1730, in _create
>     self._db._execute(query)
>   File "...\web2py\gluon\sql.py", line 897, in <lambda>
>     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> OperationalError: near "from": syntax error
>
> Is 'body' a keyword that can't be used ?
>
> model:
> db.define_table("email",
>     Field("from"),
>     Field("to"),
>     Field("subject"),
>     Field("body", "text")
> )
>
> view:
> def index():
>     form = crud.create(db.email)
>     if form.accepts(request.vars, session):
>         pass
>     return dict(form=form)

Reply via email to