Yes. There are two SQLField, one defined by gluon/sql.py (the standard
one) and one defined by gluon/contrib/gql.py (used on GAE). The latter
is overriding the former and breaking form_factory. There are two
solutions:

1)
     from gluon.sql import SQLField and Field

and use Field instead of SQLField in form_factory.

2) in db.py you have something like

    from gluon.contrib.gql import *
    ...
    db.define_field(...,SQLField(....),...)

replace this with

    from gluon.contrib.gql import SQLField
    ...
    db.define_field(...,db.Field(....),...)

so that you never import and use SQLField from gql.py



On Dec 16, 9:22 pm, Russell <russell.mcmur...@gmail.com> wrote:
> Hi there,
>
> This function works on the web2py server, but throws a syntax error on
> GAE.
>
> def _test():
>     from gluon.sqlhtml import form_factory
>     form=form_factory(SQLField('email'))
>     return dict(form=form)
>
> Here's the traceback...
>
> ERROR    2008-12-17 02:49:20,437 main.py] Traceback (most recent call
> last):
>   File "C:\GAE\google_appengine\web2py\gluon\restricted.py", line
>  62, in restricted
>     exec ccode in environment
>   File "C:\GAE\google_appengine\web2py\applications\appy/c
> ontrollers/default.py:_test", line 542, in <module>
>   File "C:\GAE\google_appengine\web2py\gluon\globals.py", line 55
> , in <lambda>
>     self._caller=lambda f: f()
>   File "C:\GAE\google_appengine\web2py\applications\appy/c
> ontrollers/default.py:_test", line 10, in _test
>   File "C:\GAE\google_appengine\web2py\gluon\sqlhtml.py", line 298, in
> form_factory
>     return SQLFORM(SQLDB(None).define_table
> ('no_table',*fields),**attributes)
>   File "C:\GAE\google_appengine\web2py\gluon\sql.py", line 566, i
> n define_table
>     t=self[tablename]=SQLTable(self,tablename,*fields)
>   File "C:\GAE\google_appengine\web2py\gluon\sql.py", line 651, i
> n __init__
>     raise SyntaxError, "define_table argument is not a SQLField"
> SyntaxError: define_table argument is not a SQLField
>
> Any suggestions?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to