Also, note that there is another problem with your view() function. You are 
using the first URL arg to identify a record, but the grid doesn't know 
about this, so when it generates its own internal URLs, it will not 
preserve the URL arg with the record ID. To tell the grid to preserve 
existing URL args in the URLs it generates, you must specify the "args" 
argument.

Anthony

On Sunday, May 8, 2016 at 2:34:22 PM UTC-4, Simon Carr wrote:
>
> I found the problem, I had to add
>
> user_signature=False
>
> to the SQLFORM.grid i.e. (SQLFORM.grid(.............,user_signature=False)
>
> This sorted out the problem
>
>
> On Sunday, 8 May 2016 17:04:52 UTC+1, DenesL wrote:
>>
>>
>> http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#login-required-by-default-for-data-updates
>> By default all the URLs generated by the grid are digitally signed and 
>> verified. This means one cannot perform certain actions (create, update, 
>> delete) without being logged-in.
>>
>>
>> On Sunday, May 8, 2016 at 11:58:08 AM UTC-4, Simon Carr wrote:
>>>
>>> Here is the code in my controller.
>>>
>>> # -*- coding: utf-8 -*-
>>> # try something like
>>> def index():
>>>     return dict(message="hello from supplier.py")
>>>
>>>
>>> def manage_suppliers():
>>>     links = [lambda row: A(SPAN(_class='glyphicon glyphicon-search'),' 
>>> View',_class='button btn btn-default',_href=URL("supplier","view",args=[
>>> row.id]))]
>>>     form = SQLFORM.grid(db.suppliers,links=links,details=False)
>>>     return locals()
>>>
>>>
>>> def view():
>>>     supplier = db.suppliers(request.args(0))
>>>     form = SQLFORM.grid(db.supplier_contacts)
>>>     return supplier
>>>
>>>
>>> I can get to manage_suppliers just fine, but when I click "View" against 
>>> one of the suppliers I get "Not Authorized".
>>>
>>> If I remove 
>>> form = SQLFORM.grid(db.supplier_contacts)
>>>
>>> from the the view method. It works fine, so the issue seems with this 
>>> line of code.
>>>
>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to