Massimo,
thank you for your very very very quick response!

I tried the workaround but it does not seem to work.
This is the trace:

Error traceback

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 173, in restricted
    exec ccode in environment
  File "C:/web2py/applications/test_mail/controllers/eammail.py", line
45, in <module>
  File "C:\web2py\gluon\globals.py", line 96, in <lambda>
    self._caller = lambda f: f()
  File "C:/web2py/applications/test_mail/controllers/eammail.py", line
19, in detail
    if f.accepts(request.vars, session):
  File "C:\web2py\gluon\sqlhtml.py", line 715, in accepts
    record_id = dict([(k,request_vars.get(k,None)) for k in
self.table._primarykey])
KeyError: 'evt_code'

In file: C:\web2py\applications\test_mail/controllers/eammail.py

# coding: utf8
# try something like

def list_emails():
    _list = db().select(db.CUS_R5KHMAIL001.evt_code,
                        db.CUS_R5KHMAIL001.mail_status,
                        db.CUS_R5KHMAIL001.object)
    th = THEAD(TH("Code"), TH("Status"), TH("Subject"), TH('Action'),
_class='cus')
    return dict(list_rcds=_list, table_header=th)

def detail():
    #try:
        if len(request.args):
 
records=db(db.CUS_R5KHMAIL001.evt_code==request.args[0]).select()
           print records
        if len(request.args) and len(records):
            f = SQLFORM(db.CUS_R5KHMAIL001, records[0],
readonly=False)
            #return dict(form=request.vars)
            if f.accepts(request.vars, session):
            #if f.accepts(records[0], session):
                response.flash='form accepted'
            elif f.errors:
                response.flash='form has errors'
            #else:
            #    response.flash="Ne' accettato ne' in errore?"
        #else:
        #    f = SQLFORM(db.CUS_R5KHMAIL001)

        return dict(form=f)
    #except KeyError:
    #   return("Errore con la chiave, evidentemente")

def grid_mail():
    grid = webgrid.WebGrid(crud)
    _list = db().select(db.CUS_R5KHMAIL001.ALL)
    grid.datasource = _list
    grid.pagesize = 10
    grid.field_headers = ['Status', 'Subject', 'Action']
    grid.enabled_rows = ['header','filter',
'pager','footer','add_links']
    grid.action_links = ['view','edit']
    grid.action_headers = ['view','edit']

    return dict(grid=grid())

response._vars=response._caller(detail)

What is there in my code so that the bug happens? I mean, if
f.accepts(request.vars, session) is such an usual operation as far as
I know. Is the reason why I experience this problem known?
Thanks again for your help, I'm totally available for further testing
and experiments.

--
Marco

On 11 Mar, 23:48, mdipierro <[email protected]> wrote:
> You have an old verison of sqlhtml but you discovered a bug and the
> bug persists in newer version.
> Can you try replace
>
> record_id = dict([(k,request_vars[k]) for k in
> self.table._primarykey])
>
> with
>
> record_id = dict([(k,request_vars.get(k,None)) for k in
> self.table._primarykey])
>
> Let us know if this fixes it and I will put it in trunk.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to