If I write this function

@auth.requires(lambda: (auth.requires_login() and request.env.http_referer
                        and '/client' in request.env.http_referer))
def on_delete(table: pydal.objects.Table, rec_id: str):
    """Grid delete button action.

    :param table: Table.
    :param rec_id. Record id.
    """
    if auth.has_membership(SUPERVISOR_ROLE) or 
auth.has_membership(MANAGER_ROLE):
        row: pydal.objects.Row = table[rec_id]
        row.update_record(cancel_approved_by=auth.user_id, 
canceled_by=auth.user_id,
                          canceled_on=request.now, is_active=False)
        session.flash = T('Press F5 to refresh.')
        redirect(URL(user_signature=True))
    else:
        redirect(URL('get_approval', args=[rec_id], user_signature=True))


web2py/Python show this error

    def on_delete(table: pydal.objects.Table, rec_id: str):
NameError: name 'pydal' is not defined


What is even stranger is that inside the same function there is this command
row: pydal.objects.Row = table[rec_id]
and web2py/Python don't show any error, which means they recognize pydal.


Windows 7 Pro x64 SP1+all updates
Firefox 65.0.2 x64
Python 3.7.1 x86
web2py 2.18.3

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to