How is request.vars.table being set? For that to work, presumably you would 
need "?table=some_table" in the query string of the URL used to access the 
grid.

Anthony

On Friday, August 7, 2015 at 6:27:52 PM UTC-4, ESRA GÜÇLÜ wrote:
>
>
> Hi ,
> I'm pretty new to web2py, I'm developing a project for my internship and i 
> have a problem.
>
> My program gets a choice from user and according to the choice it shows db 
> table on the SQLFORM.grid.
> SQLFORM.grid is displaying but the user cannot add new record or delete or 
> update. This is my code:
>
> def operations():
>     table_name = request.vars.table
>     grid = SQLFORM.grid(db[table_name], user_signature=False)
>     return locals()
>
> i have this error: <type 'exceptions.AttributeError'> 
>
> Version 2.11.2-stable+timestamp.2015.05.30.16.33.24
>
> Traceback (most recent call last):
>   File "C:\web2py_win\web2py\gluon\restricted.py", line 227, in restricted
>     exec ccode in environment
>   File "C:/web2py_win/web2py/applications/Inventory/controllers/admin.py" 
> <http://127.0.0.1:8000/admin/default/edit/Inventory/controllers/admin.py>, 
> line 22, in <module>
>   File "C:\web2py_win\web2py\gluon\globals.py", line 412, in <lambda>
>     self._caller = lambda f: f()
>   File "C:/web2py_win/web2py/applications/Inventory/controllers/admin.py" 
> <http://127.0.0.1:8000/admin/default/edit/Inventory/controllers/admin.py>, 
> line 19, in operations
>     grid = SQLFORM.grid(db[table_name], user_signature=False)
>   File "C:\web2py_win\web2py\gluon\packages\dal\pydal\base.py", line 899, in 
> __getitem__
>     return self.__getattr__(str(key))
>   File "C:\web2py_win\web2py\gluon\packages\dal\pydal\base.py", line 906, in 
> __getattr__
>     return super(DAL, self).__getattr__(key)
>   File "C:\web2py_win\web2py\gluon\packages\dal\pydal\helpers\classes.py", 
> line 348, in __getattr__
>     raise AttributeError
> AttributeError
>
>
> Best regards.
>

-- 
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