Re: [web2py] Re: Best practices: When to use classes

2011-12-02 Thread Bruno Rocha
On Fri, Dec 2, 2011 at 5:46 PM, pbreit wrote: > I'm interested in this approach and these samples are very helpful but it > seems like there is still a ways to go. Would it be possible to create some > sort of welcome-like model-less bootstrap? Look in to my modules here: https://github.com/roc

Re: [web2py] Re: Best practices: When to use classes

2011-12-02 Thread Richard Vézina
Pretty much interrested too... I would start with menu.py since I use conditional group menu. What do I have to do... Richard On Fri, Dec 2, 2011 at 2:46 PM, pbreit wrote: > I'm interested in this approach and these samples are very helpful but it > seems like there is still a ways to go. Woul

Re: [web2py] Re: Best practices: When to use classes

2011-12-02 Thread pbreit
I'm interested in this approach and these samples are very helpful but it seems like there is still a ways to go. Would it be possible to create some sort of welcome-like model-less bootstrap?

[web2py] Re: Best practices: When to use classes

2011-12-02 Thread Lazarof
Optimize your web2py app using the new import method http://martin.tecnodoc.com.ar/default/post/2011/09/12/7_optimize-your-web2py-app-using-the-new-import-method On Dec 2, 2:53 pm, kenji4569 wrote: > I think there are two types of web applications; one is for admin- > site, and the other is for

[web2py] Re: Best practices: When to use classes

2011-12-02 Thread kenji4569
I think there are two types of web applications; one is for admin- site, and the other is for front-site. For admin-site, CPU-usage would be relatively not so critical, and rich man's programming (fat models in web2py) could be allowed. Front-site, on the other hand, needs optimization as far as po

Re: [web2py] Re: Best practices: When to use classes

2011-12-01 Thread Bruno Rocha
Actually you dont need even an ajax callback. Take this example: ## models/script.py ## db.define_table("mytable", Field("picture", "upload")) print "models executed!" ## controllers/default.py ## def index(): pictures = db(db.mytable).select() return dict(pictures=pictures) def downl

Re: [web2py] Re: Best practices: When to use classes

2011-12-01 Thread Anthony
Cool. Thanks for sharing. On Thursday, December 1, 2011 8:19:05 PM UTC-5, rochacbruno wrote: > > > > On Thu, Dec 1, 2011 at 11:01 PM, Anthony wrote: > >> Also, isn't it sometimes useful to put code in a model file that you want >> to run on every (or nearly every) request without having to do an

Re: [web2py] Re: Best practices: When to use classes

2011-12-01 Thread Bruno Rocha
On Thu, Dec 1, 2011 at 11:17 PM, lyn2py wrote: > Model files are run on every request - does that mean having a complex > database structure would slow the entire site down? > Yes, if you everything you have in models will be executed even if you are just serving a simple contact form or an smal

Re: [web2py] Re: Best practices: When to use classes

2011-12-01 Thread Bruno Rocha
On Thu, Dec 1, 2011 at 11:01 PM, Anthony wrote: > Also, isn't it sometimes useful to put code in a model file that you want > to run on every (or nearly every) request without having to do an import? Yes, some helping functions and objects i think is very useful to have in modules, but not Auth

[web2py] Re: Best practices: When to use classes

2011-12-01 Thread lyn2py
Just a thought. Model files are run on every request - does that mean having a complex database structure would slow the entire site down? On Dec 2, 9:01 am, Anthony wrote: > On Thursday, December 1, 2011 7:48:29 PM UTC-5, rochacbruno wrote: > > > I have an opinion about that. > > > For me the /

Re: [web2py] Re: Best practices: When to use classes

2011-12-01 Thread Anthony
On Thursday, December 1, 2011 7:48:29 PM UTC-5, rochacbruno wrote: > > I have an opinion about that. > > For me the /models folders should be renamed to /scripts since it has > scripts that are executed in every request. I suppose you could be strict about it and only include model related code

Re: [web2py] Re: Best practices: When to use classes

2011-12-01 Thread Bruno Rocha
I have an opinion about that. For me the /models folders should be renamed to /scripts since it has scripts that are executed in every request. Going on this approach I am only writing model-less (or script-less) apps. I am now recommending to all of my students and clients to avoid the use of mo

[web2py] Re: Best practices: When to use classes

2011-12-01 Thread pbreit
I forgot that there are some parts of Web2py that do use classes such as Virtual Fields. For those, I would suggest just copy/pasting from the Book and then editing.

[web2py] Re: Best practices: When to use classes

2011-12-01 Thread lyn2py
Thanks Alan for sharing the link to Martin's slides. I can't read Spanish so I don't understand most of it, but I briefly caught the idea to use classes in modules (define tables). On Dec 1, 7:24 pm, Alan Etkin wrote: > Martin Mulone has made a great work documenting new web2py features > and pr

[web2py] Re: Best practices: When to use classes

2011-12-01 Thread Alan Etkin
Martin Mulone has made a great work documenting new web2py features and presents some tricks on using class oriented web2py: His work has not been translated to english yet (it is in spanish): http://www.slideshare.net/martinpm/web2py-pensando-en-grande-9448110 On Dec 1, 6:05 am, pbreit wrote: >

[web2py] Re: Best practices: When to use classes

2011-12-01 Thread pbreit
I wouldn't worry about classes at this point. You don't need to use them at all in Web2py.