personID = db.auth_user(request.args(0)) or redirect(...)
The redirect is there in case there is no request.args(0).
You have to think about these things and provide a nice handling for the
end user, otherwise they end up looking at a screen with an error message
that could and should have been avoided.
An if works equally well if you are not that familiar with sentences like
the one above in python.
What are you trying to accomplish?.
It seems that you are just copying code from examples but not thinking
about it.
Following the manual is a good starting point.
On Saturday, November 8, 2014 1:00:14 PM UTC-5, Alex Glaros wrote:
>
> now receive error: <type 'exceptions.SyntaxError'> Set: no tables selected
>
> HTML
> {{=personID.last_name}}
>
> CONTROLLER
> @auth.requires_login()
> def view_user_profile():
> personID=db(db.auth_user(request.args(0))).select()
> return locals()
>
> ERROR REPORT
> locals
> args_get:<built-in method get of dict object>attributes:{}fields:[]query:<Row
> {'last_name': 'babatunde', 'modified_by': 4...on': datetime.datetime(2014,
> 5, 25, 18, 13, 32)}>self:<gluon.dal.SQLiteAdapter object>tablenames:[]
> tablenames_for_common_filters:[]tables:<bound method SQLiteAdapter.tables
> of <gluon.dal.SQLiteAdapter object>>
> request
> ajax:Falseapplication:ES1args:7
>
> PATH_INFO:/ES1/default/view_user_profile/7
>
>
> PRECEDING SCRIPT - Not sure if relevant, but view_user_profile controller
> is called by this statement from a view
> <td> {{if auth.user_id == objectComment.created_by:}}
> {{=A(objectComment.created_by.first_name,
> _href=URL('default','view_user_profile', args=objectComment.created_by),
> _class='btn btn-min')}}</td>
>
>
>
>
--
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.