Best practice to check for raw_args

35 views
Skip to first unread message

LoveWeb2py

unread,
Dec 30, 2016, 7:27:00 PM12/30/16
to web2py-users
Hello,

I'm wondering if it's better to check for raw_args inside of the controller or in the view and then call another controller based on that.

For example:

I have: 


which returns a SQLFORM.Grid

Inside of the grid I now have clickable links which will go to


What is the recommended approach to check for the arg. 

I want to show the relational fields to the record so I will need to call db.table.id==arg and create a new SQLFORM based on that.

黄祥

unread,
Dec 30, 2016, 8:09:10 PM12/30/16
to web2py-users
why not use if condition to check args that meet with ur requirements?
e.g.
# if not sure about args value
if 'args' in request.args:
# bla bla

# if sure about args value
if request.args == 'args':
# bla bla

best regards,
stifan

LoveWeb2py

unread,
Dec 30, 2016, 8:26:08 PM12/30/16
to web2py-users
Hi Stifan, 

Thank you for replying again.

Is the best way to check for that in the controller? The book says it's best to handle calls in the controller, but just confirming on the forum.

Anthony

unread,
Dec 31, 2016, 8:56:26 AM12/31/16
to web2py-users
On Friday, December 30, 2016 at 8:26:08 PM UTC-5, LoveWeb2py wrote:
Hi Stifan, 

Thank you for replying again.

Is the best way to check for that in the controller? The book says it's best to handle calls in the controller, but just confirming on the forum.

It is generally recommended to keep most logic out of the view, particularly if it does not pertain to the presentation of the data.

Anthony

LoveWeb2py

unread,
Dec 31, 2016, 3:56:43 PM12/31/16
to web2py-users
Thank you!
Reply all
Reply to author
Forward
0 new messages