Given this excerpt from the py4web documentation:
The request object
>From py4web you can import request
from py4web import request
@action('paint')
def paint():
if 'color' in request.query
return 'Painting in %s' % request.query.get('color')
return 'You did not specify a color'
This action can be accessed at:
http://localhost:8000/myapp/paint?color=red
Notice that the request object is the a Bottle request object
My controller signature looks like this:
@action('administration/links', method=['GET', 'POST'])
@action.uses('list.html', session, db, auth.user)
def links():
current_page_number = request.query.get('page') if 'page' in request.query
else 1
But, when I try to access:
http://127.0.0.1:8000/py4web_test/link?page=2
I get a 404 error. - WARNING:tornado.access:404 GET
/py4web_test/link?page=2 (127.0.0.1) 1.79ms
I'm not sure what I'm doing wrong. Is there a way to tell it that you have
an optional parameter that may or may not be passed in?
-Jim
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/26966e99-0c9e-4599-95c3-a5556b8027f3%40googlegroups.com.