Re: [web2py] not authorised flash message when I used SQLFORM.grid, but worked fine with SQLFORM.smartgrid

2017-06-06 Thread Rudy
Right on Anthony, I don't think user_signature=False is the real fix for 
the strange behaviour. When i tested it, i did log in, plus i used 
smartgrid the same way. Thanks for confirming it.

On Monday, June 5, 2017 at 9:14:48 PM UTC+8, Anthony wrote:
>
> On Monday, June 5, 2017 at 1:11:25 AM UTC-4, akshay0...@gmail.com 
>  wrote:
>>
>> I could't use the smartgrid because smartgrid works on complete table but 
>> i had to query the table first.
>>
>
> The smartgrid has the "constraints" argument for that purpose (it is a 
> dictionary with table names as keys and DAL queries as values). See 
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#smartgrid-signature
> .
>  
>
>> I still don't know what the problem was but solution given by @Leandro 
>> Paz worked.
>>
>> you just have to do:
>> grid = SQLFORM.grid (db.auth_user, user_signature = False)
>>
>>
> I don't think that is related to the problem Rudy is having. By default, 
> user_signature=True, which simply means the grid will not display 
> create/edite/delete buttons (nor allow those operations). You wouldn't get 
> a "not authorized" message simply by attempting to load the grid. 
> Furthermore, for logged in users, create/edit/delete is allowed, even with 
> user_signature=True, and Rudy indicated his code started with using the 
> @auth.requires_login() decorator, which requires a logged in user.
>
> Anthony
>

-- 
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.


Re: [web2py] not authorised flash message when I used SQLFORM.grid, but worked fine with SQLFORM.smartgrid

2017-06-05 Thread Rudy
Hi Akshay,

Thanks for confirming Leandro Paz suggestion and replying me, I truly think 
this forum needs all of us (even I still have a lot to learn in web2py) to 
participate to share scenarios and solutions.

For smartgrid, you can still use query I believe, I have something like 
below. Good luck, hope to see you here again.

query=db.quotation.id == quote_id
grid = SQLFORM.smartgrid(db.quotation, args=request.args[:1], 
constraints=dict(quotation=query), )

On Monday, June 5, 2017 at 1:11:25 PM UTC+8, akshay0...@gmail.com wrote:
>
> Hi rudy,
>   yes you are right. Web2py editor behaves funny sometimes. 
> Sometimes you get error and same error goes away when you rewrite the same 
> code.
>
> I could't use the smartgrid because smartgrid works on complete table but 
> i had to query the table first. so only option for me was SQLFORM.grid.
>
> I still don't know what the problem was but solution given by @Leandro 
> Paz worked.
>
> you just have to do:
> grid = SQLFORM.grid (db.auth_user, user_signature = False)
>
>
>
> On Friday, June 2, 2017 at 11:24:12 PM UTC+5:30, Rudy wrote:
>>
>> Hi Akshay,
>>
>> I don’t know where the problem was. As mentioned in previous thread, 
>> after i used smartgrid to continue the development for a few days, it went 
>> away. One thing i notice is the editor from the administrative interface 
>> gets funny behavior sometimes, the compiler raises error but I simply can’t 
>> find what goes wrong with the specific line pointed out from the ticket, if 
>> I delete the line and retype exactly the same thing (I even had 2 lines 
>> side by side to compare the difference), the error goes away. But I can’t 
>> explain why below issue complains about “not authorised”, well try to 
>> refresh your editor or use another editor to check the code, perhaps 
>> restart web2py. I know it sounds silly, but they are quick test. cheers!
>>
>> On 2 Jun, 2017, at 7:07 pm, akshay...@gmail.com wrote:
>>
>> hi Rudy,
>>I am facing the same issue. Did you get why this is happeneing?
>> On Saturday, April 22, 2017 at 1:49:15 PM UTC+5:30, Rudy wrote:
>>>
>>> Hi there,
>>>
>>> It feels really strange to me that when i used SQLFORM.grid(), I got a 
>>> flash message "not authorised", but when i used smartgrid(), it worked just 
>>> fine (in both cases i had logged in already). I tried to removed 
>>> @auth.requires_login(), but same behaviour happened. I seem to miss some 
>>> very fundamental knowledge using SQLFORM.grid(). Below is the simplified 
>>> code. Any help is much appreciated.
>>>
>>> @auth.requires_login()
>>> def list_items2():
>>> response.view='accounting/list_items.html'
>>> grid = SQLFORM.grid(db.auth_user)
>>> return locals()
>>>
>>
>> -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/yhj6iVXgHEM/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
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.


Re: [web2py] not authorised flash message when I used SQLFORM.grid, but worked fine with SQLFORM.smartgrid

2017-06-05 Thread Anthony
On Monday, June 5, 2017 at 1:11:25 AM UTC-4, akshay055ku...@gmail.com wrote:
>
> I could't use the smartgrid because smartgrid works on complete table but 
> i had to query the table first.
>

The smartgrid has the "constraints" argument for that purpose (it is a 
dictionary with table names as keys and DAL queries as values). See 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#smartgrid-signature.
 

> I still don't know what the problem was but solution given by @Leandro 
> Paz worked.
>
> you just have to do:
> grid = SQLFORM.grid (db.auth_user, user_signature = False)
>
>
I don't think that is related to the problem Rudy is having. By default, 
user_signature=True, which simply means the grid will not display 
create/edite/delete buttons (nor allow those operations). You wouldn't get 
a "not authorized" message simply by attempting to load the grid. 
Furthermore, for logged in users, create/edit/delete is allowed, even with 
user_signature=True, and Rudy indicated his code started with using the 
@auth.requires_login() decorator, which requires a logged in user.

Anthony

-- 
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.


Re: [web2py] not authorised flash message when I used SQLFORM.grid, but worked fine with SQLFORM.smartgrid

2017-06-04 Thread akshay055kumar
Hi rudy,
  yes you are right. Web2py editor behaves funny sometimes. 
Sometimes you get error and same error goes away when you rewrite the same 
code.

I could't use the smartgrid because smartgrid works on complete table but i 
had to query the table first. so only option for me was SQLFORM.grid.

I still don't know what the problem was but solution given by @Leandro Paz 
worked.

you just have to do:
grid = SQLFORM.grid (db.auth_user, user_signature = False)



On Friday, June 2, 2017 at 11:24:12 PM UTC+5:30, Rudy wrote:
>
> Hi Akshay,
>
> I don’t know where the problem was. As mentioned in previous thread, after 
> i used smartgrid to continue the development for a few days, it went away. 
> One thing i notice is the editor from the administrative interface gets 
> funny behavior sometimes, the compiler raises error but I simply can’t find 
> what goes wrong with the specific line pointed out from the ticket, if I 
> delete the line and retype exactly the same thing (I even had 2 lines side 
> by side to compare the difference), the error goes away. But I can’t 
> explain why below issue complains about “not authorised”, well try to 
> refresh your editor or use another editor to check the code, perhaps 
> restart web2py. I know it sounds silly, but they are quick test. cheers!
>
> On 2 Jun, 2017, at 7:07 pm, akshay...@gmail.com  wrote:
>
> hi Rudy,
>I am facing the same issue. Did you get why this is happeneing?
> On Saturday, April 22, 2017 at 1:49:15 PM UTC+5:30, Rudy wrote:
>>
>> Hi there,
>>
>> It feels really strange to me that when i used SQLFORM.grid(), I got a 
>> flash message "not authorised", but when i used smartgrid(), it worked just 
>> fine (in both cases i had logged in already). I tried to removed 
>> @auth.requires_login(), but same behaviour happened. I seem to miss some 
>> very fundamental knowledge using SQLFORM.grid(). Below is the simplified 
>> code. Any help is much appreciated.
>>
>> @auth.requires_login()
>> def list_items2():
>> response.view='accounting/list_items.html'
>> grid = SQLFORM.grid(db.auth_user)
>> return locals()
>>
>
> -- 
> 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 a topic in the 
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/yhj6iVXgHEM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+un...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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.


Re: [web2py] not authorised flash message when I used SQLFORM.grid, but worked fine with SQLFORM.smartgrid

2017-06-02 Thread Rudy Leung
Hi Akshay,

I don’t know where the problem was. As mentioned in previous thread, after i 
used smartgrid to continue the development for a few days, it went away. One 
thing i notice is the editor from the administrative interface gets funny 
behavior sometimes, the compiler raises error but I simply can’t find what goes 
wrong with the specific line pointed out from the ticket, if I delete the line 
and retype exactly the same thing (I even had 2 lines side by side to compare 
the difference), the error goes away. But I can’t explain why below issue 
complains about “not authorised”, well try to refresh your editor or use 
another editor to check the code, perhaps restart web2py. I know it sounds 
silly, but they are quick test. cheers!

> On 2 Jun, 2017, at 7:07 pm, akshay05ku...@gmail.com wrote:
> 
> hi Rudy,
>I am facing the same issue. Did you get why this is happeneing?
> On Saturday, April 22, 2017 at 1:49:15 PM UTC+5:30, Rudy wrote:
> Hi there,
> 
> It feels really strange to me that when i used SQLFORM.grid(), I got a flash 
> message "not authorised", but when i used smartgrid(), it worked just fine 
> (in both cases i had logged in already). I tried to removed 
> @auth.requires_login(), but same behaviour happened. I seem to miss some very 
> fundamental knowledge using SQLFORM.grid(). Below is the simplified code. Any 
> help is much appreciated.
> 
> @auth.requires_login()
> def list_items2():
> response.view='accounting/list_items.html'
> grid = SQLFORM.grid(db.auth_user)
> return locals()
> 
> -- 
> 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 a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/yhj6iVXgHEM/unsubscribe 
> .
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
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.


[web2py] not authorised flash message when I used SQLFORM.grid, but worked fine with SQLFORM.smartgrid

2017-04-22 Thread Rudy
Hi there,

It feels really strange to me that when i used SQLFORM.grid(), I got a 
flash message "not authorised", but when i used smartgrid(), it worked just 
fine (in both cases i had logged in already). I tried to removed 
@auth.requires_login(), but same behaviour happened. I seem to miss some 
very fundamental knowledge using SQLFORM.grid(). Below is the simplified 
code. Any help is much appreciated.

@auth.requires_login()
def list_items2():
response.view='accounting/list_items.html'
grid = SQLFORM.grid(db.auth_user)
return locals()

-- 
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.