Thanks Jim - I appreciate it. Yes - I keep forgetting that for some reason Python has redefined a lot of terms. Dictionaries confused me until I realized that they were pretty much the same as keyed arrays in PHP and other languages. Not sure why so much relabelling but it certainly makes the learning curve a little steeper.
I'm trying to get py4web running for comparison as that seems to be the natural follow on to to web2py. Have you any experience with that? > On Apr 23, 2020, at 11:05 AM, Jim S <[email protected]> wrote: > > Jon > > I'd really encourage you to not give up on this. I think your assessment is > correct; there have been a lot changes to the code since that doc was > originally written and it might be hard to navigate. I went through it back > in 2011, I read it from front to back before even trying to code with it. > > I'd had experience with other Python web frameworks, most notably, > TurboGears. Web2py was a breath of fresh air. So well documented, so well > thought out. > > However, at that time, I'd been coding in Python for about 6 years already. > I think some of the bumps you're running into might be due to being newer to > Python; decorators for example, are a python concept. > > If you're looking for a python web framework to get started with, I think > web2py is the most approachable. I've also worked with Flask a bit and feel > that web2py gives you a lot more 'out of the box' whereas Flask requires you > to make decisions on which extensions to use. Django is a great framework, > but it just never clicked with me > > I'm happy to help you in any way I can. You've given so much to the IBM i > community. It's my way of saying thank you. > > Let me know if you'd like to get on a call or video conference sometime. I'm > pretty flexible with my schedule. > > -Jim > > On Thursday, April 23, 2020 at 9:52:25 AM UTC-5, Jon Paris wrote: > 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/> > - http://web2py.com/book <http://web2py.com/book> (Documentation) > - http://github.com/web2py/web2py <http://github.com/web2py/web2py> (Source > code) > - https://code.google.com/p/web2py/issues/list > <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] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/3a7865a7-6e9a-48c0-9e26-aeb9674b792e%40googlegroups.com > > <https://groups.google.com/d/msgid/web2py/3a7865a7-6e9a-48c0-9e26-aeb9674b792e%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/361F9D94-1738-4D1A-8F3A-F8A369D07BB2%40partner400.com.

