response.models_to_run is really nice. It's not documented yet. :-(
On Thu, May 16, 2013 at 11:10 AM, Anthony <abasta...@gmail.com> wrote: > Well, you can think of the "models" folder strictly as containing things > related to the data model, or you can think of it more broadly as containing > anything you want available globally on every request (or most requests). In > any case, you have two choices -- if you want the helpers defined and > available in the global environment on every request, put them in the models > folder -- otherwise, put them in the modules folder (or anywhere in the > pythonpath) and import them. > > Note, you can create a "helpers" sub-folder inside the models folder. By > default, web2py will assume the files in that folder should only be executed > when the controller name is "helpers", but you can override that using > response.models_to_run. Note, though, that models in sub-folders always run > after all model files in the top-level models folder. > > Anthony > > On Thursday, May 16, 2013 9:46:36 AM UTC-4, Domagoj Kovač wrote: >> >> They are currently in models, but i don't think models are the best place. >> Is it possible to make one extra folder names "helpers" and put them there, >> and how to include them? >> >> I moved all my create_table definitions to 0.py model, is this preffered >> way, or they should be in associated models? >> >> >> On Thursday, May 16, 2013 3:40:06 PM UTC+2, Anthony wrote: >>> >>> You could put them in a model file, which will make them available >>> everywhere on every request, or you can put them in a module and import them >>> when needed. >>> >>> Anthony >>> >>> On Thursday, May 16, 2013 9:13:05 AM UTC-4, Domagoj Kovač wrote: >>>> >>>> Hi, >>>> i have bunch of functions that i would like to extract to helper >>>> classes. >>>> >>>> Where should i put this helpers and how to include them? > > -- > > --- > 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. > > -- --- 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.