Add an argument to the function: foo(bar): Only functions with no arguments can be called from the outside world.
On Tuesday, December 31, 2013 3:57:56 AM UTC-6, Wei Li wrote: > > Hi, > > This could be a silly question:) . I am going to build up some > application logic. So I will create a few class and functions. Looks like > it's not very good to put these code under controllers. Although from the > manual, it says controller folder is for application logic and workflow. > See if I have a function > > def foo(): > return <SOME_SENSITIVE_INFORMATION> > > > I don't want to put this function in controllers/default.py because people > can see the return value of foo() through http://myapp/default/foo which > is not expected. I just want foo() to be a normal function instead of a > controller function. > > So my question is where is the best place to put my own application > logical codes indeed? There are three places that I can put python codes > into: > > > - *models* describe a representation of the data as database tables > and relations between tables. > - *controllers* describe the application logic and workflow. > - *modules *are other optional Python modules. > > > Looks like to me *modules *is the best place. But the new problem is the > global objects and classes are not visible to files in modules unlike files > in models/controllers. I am not sure which packages need to be imported. It > will be convenient if *modules *folder can be treated same as > models/controllers? > > Any suggestion is appreciated. > > Thanks, > Wei > -- 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/groups/opt_out.