py4web - method not allowed

45 views
Skip to first unread message

Jim S

unread,
Jan 21, 2020, 9:10:16 AM1/21/20
to web2py-users
I'm getting the following when I click on the submit button on my form:

Error: 405 Method Not Allowed

Sorry, the requested URL 'http://127.0.0.1:8000/py4web_test/administration/links' caused an error:

Method not allowed.

My controller code:

@action('administration/links', methods=['GET', 'POST'])
@action.uses('grid.html', session, db, auth.user)
def links():
    url_path
= 'administration/links'
    page
['sub_title'] = A('LINKS', _href=URL(url_path))

    form
= Form([Field('search', length=50)], formstyle=FormStyleBulma)

    query
= db.link.id > 0
    fields
= [db.link.id, db.link.name, db.link.table_name, db.link.permission_name, db.link.method]

    grid
= Grid(url_path, query, fields=fields,
                search_form
=form,
                create_url
=URL('administration/link/0'),
                edit_url
=URL('administration/link'),
                delete_url
=URL('administration/link/delete'))

   
return dict(page=page, grid=grid, form=form)

I'm guessing there is something obvious I'm missing.  Can anyone see it?  Any help would be appreciated.

-Jim


Val K

unread,
Jan 21, 2020, 12:21:44 PM1/21/20
to web2py-users
Try method=... instead of methodS

Jim S

unread,
Jan 21, 2020, 12:35:47 PM1/21/20
to web2py-users
Thank you, that did the trick.

Now however, I'm getting this traceback:
ERROR:root:Traceback (most recent call last):
 
File "/home/jim/.local/lib/python3.7/site-packages/py4web/core.py", line 543, in wrapper
    ret
= func(*func_args, **func_kwargs)
 
File "/home/jim/.local/lib/python3.7/site-packages/py4web/core.py", line 503, in wrapper
    ret
= func(*args, **kwargs)
 
File "apps/py4web_test/controllers/administration.py", line 27, in links
    form
= Form([Field('search', length=50)], formstyle=FormStyleBulma)
 
File "/home/jim/.local/lib/python3.7/site-packages/py4web/utils/form.py", line 241, in __init__
   
(value, error) = field.validate(value, record_id)
TypeError: validate() takes 2 positional arguments but 3 were given

Controller code is exactly the same as above.

-Jim

On Tuesday, January 21, 2020 at 11:21:44 AM UTC-6, Val K wrote:
Try method=... instead of methodS

Val K

unread,
Jan 21, 2020, 1:29:04 PM1/21/20
to web2py-users
It seems that your pydal is out of date, try to update it

Jim S

unread,
Jan 21, 2020, 2:48:48 PM1/21/20
to web2py-users
Thank you again.  Yes, that fixed it.

-Jim
Reply all
Reply to author
Forward
0 new messages