It's true, when i delete/adjust the db definition statement it's
working.
It seems, when i choose another name as "db" webgrid can not handle
this. Is that true ?

Stefan

On May 8, 9:59 pm, "mr.freeze" <[email protected]> wrote:
> Did you delete the default DAL declaration at the top of db.py? Your
> code works for me.
>
> On May 8, 2:04 pm, winti <[email protected]> wrote:
>
>
>
> > i changed it to myid and i get a error on:
> > KeyError: 'myid'
>
> > Stefan
>
> > On May 8, 8:51 pm, "mr.freeze" <[email protected]> wrote:
>
> > > 'identity' is probably a reserved word in sqlite. Try changing it to
> > > something else.
>
> > > On May 8, 1:36 pm, winti <[email protected]> wrote:
>
> > > > Hello,
> > > > in a controller i define a temp db and want to return the results with
> > > > webgrid to a view.
> > > > I get a Keyerror on 'identity'.
>
> > > > Traceback (most recent call last):
> > > >   File "/data/projects/frameworks/web2py/applications/gluon/
> > > > restricted.py", line 178, in restricted
> > > >     exec ccode in environment
> > > >   File "/data/projects/frameworks/web2py/applications/applications/
> > > > eDir/controllers/default.py", line 190, in <module>
> > > >   File "/data/projects/frameworks/web2py/applications/gluon/
> > > > globals.py", line 96, in <lambda>
> > > >     self._caller = lambda f: f()
> > > >   File "/data/projects/frameworks/web2py/applications/applications/
> > > > eDir/controllers/default.py", line 187, in queryaddr
> > > >     return dict(resi1=res,grid=grid())
> > > >   File "/data/projects/frameworks/web2py/applications/applications/
> > > > eDir/modules/webgrid.py", line 229, in __call__
> > > >     field = db[t][f]
> > > >   File "/data/projects/frameworks/web2py/applications/gluon/sql.py",
> > > > line 1318, in __getitem__
> > > >     return dict.__getitem__(self, str(key))
> > > > KeyError: 'identity'
>
> > > > def xyz():
>
> > > > db=SQLDB('sqlite:memory:')
> > > >         db.define_table("identity",
> > > >                 db.Field("user","string",default=""),
> > > >                 db.Field("ip","string",default=""),
> > > >                 db.Field("type","string",default=""))
>
> > > > ...
> > > > ...
> > > > ....
> > > > db.identity.insert(user=user,ip=ipreadeable,type=type)
> > > > ...
> > > > ...
>
> > > > grid = webgrid.WebGrid(crud)
> > > > grid.datasource = db(db.identity.id<0).select()
>
> > > > Any idea
>
> > > > Stefan

Reply via email to