Hi,

here is the situation:

TABLE:

db.define_table('amsg',
                Field('ufrom'),
                Field('uto', 'reference auth_user'),
                Field('mailbox_to_use','list:string',requires=IS_IN_SET((
'internal','private'),multiple=True),
                       default=['internal']),
                Field('subject'),
                Field('jatom','json',required=True),
                Field('created_date',default=str(request.now.date())),
                Field('created_on','datetime',required=True,default=request.
now))

db.amsg.body =  Field.Virtual('body',
lambda row: ''.join('{0}\n{1}\n\n'.format(k,'  '.join([vi.encode("utf-8") 
for vi in v])) for k,v in   row.amsg.jatom.items()))



CONTROLLER FUNCTION

def show_amsg():
    q = db.amsg.id == request.args(0)
    fld=[db.amsg.ufrom,db.amsg.uto,db.amsg.subject,db.amsg.created_date,db.
amsg.body]
    hd = {'amsg.ufrom':'From','amsg.uto':'To','amsg.subject':'subject',
'amsg.created_date':'date','amsg.body':'message'}
    form = SQLFORM.grid(q,fields=fld,headers=hd,editable=False,create=False,
paginate=12,csv=False,user_signature=False)
    return dict(form=form)



Traceback (most recent call last):
  File "/opt/web2py/gluon/restricted.py", line 227, in restricted
    exec ccode in environment
  File "/opt/web2py/applications/prox/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/proxima/controllers/default.py>, line 
576, in <module>
  File "/opt/web2py/gluon/globals.py", line 412, in <lambda>
    self._caller = lambda f: f()
  File "/opt/web2py/applications/prox/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/proxima/controllers/default.py>, line 
366, in show_amsg
    form = 
SQLFORM.grid(q,fields=fld,headers=hd,editable=False,create=False,paginate=12,csv=False,user_signature=False)
  File "/opt/web2py/gluon/sqlhtml.py", line 2710, in grid
    value = row[str(field)]
  File "/opt/web2py/gluon/packages/dal/pydal/objects.py", line 76, in 
__getitem__
    raise KeyError
KeyError


what's wrong  ??

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