Responses in-line Jim - but before I get to that I really want to thank you 
for your assistance and patience.  I now have to give some serious thought 
to whether following this document is a worthwhile exercise as it seems to 
be so far off the mark as far as the current version is concerned. 

On Wednesday, April 22, 2020 at 6:55:35 PM UTC-4, Jim S wrote:
>
> That is your default.py, correct?
>

Correct
 

> Which function are you trying to protect with authorization?  I'm guessing 
> it's the index or show.
>

I'm just trying to follow the documentation - more in a moment

First off, I'd get rid of the user and download functions you added.  They 
> are already in place as they should be (the ones at the bottom are what you 
> want).
>

Wow - obviously another case where the documentation has been made obsolete 
by changes in the scaffold code.  I didn't notice that. The scaffold 
includes so much and nothing in the docs gives any hint as to whether it is 
needed and "just leave it alone" or what you should do. I get the feeling 
that this tutorial was very useful for an earlier version of the tool but 
has not been updated as changes were made. I now know to look at every 
singe function I'm told to add to see if a version is already in place. 

The problem now is it is not longer clear which code causes these things to 
be actioned. I now know that all that was needed was the 
@auth.requires_login()  
  

> If I'm correct in my guess about protecting index or show, then you need 
> to add a decorator to them.
>
> I'd add
>
> @auth.requires_login() 
>
> on the line above:
>
> def show():
>

I did that and removed the dups and it now works as it should.  Now that I 
know this I went back to the document and I now see why I missed it. The 
wording is "We can now decorate the functions that we want to restrict, for 
example:" - note the "for example".  Since I wasn't interested in 
"decorating" (because to me based on other tools I have used it means to 
pretty up and add text labels, colors,  etc.). I foolishly assumed that all 
the other lines I had been told to add were what would invoke the 
authentication.

Anyway - thanks again.  Maybe I'll try one more section before I give up on 
this thing.

   

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/57094597-b0ee-404b-9480-98df3aa70bae%40googlegroups.com.

Reply via email to