Perfect - Thanks for clarifying Anthony, I missed that in the original thread
On Monday, August 20, 2012 3:17:47 PM UTC-4, Anthony wrote: > > There used to be a problem with potential memory leaks when defining > classes in models and controllers (because they are executed). However, > that problem was fixed. Now, the only limitation is that if you define a > class in a model or controller, it should not include a __del__ method (and > in general, a Python class should not include a __del__ method if its > instances will contain circular references). This was clarified in the same > thread as the original link Yarin posted. > > Anthony > > On Monday, August 20, 2012 3:12:57 PM UTC-4, rochacbruno wrote: >> >> You can define classes on models or controllers, the only caveat is that >> you can never import that classes in to other modules. >> >> They will be defined and will be available for the current request on >> global environment (means that it will be available on the flow of >> models->called-controller->rendered view) >> >> I never had any problem using classes on models or controllers. >> >> >> On Mon, Aug 20, 2012 at 3:41 PM, Yarin <[email protected]> wrote: >> >>> >>> In this >>> post<https://groups.google.com/forum/#!topic/web2py/dmN54cpMuXo%5B1-25%5D> >>> Massimo >>> says: >>> >>> "One should not define classes in Models and Controllers. I have issued >>> that warning already to our users..." >>> >>> On the other hand, in this >>> post<https://groups.google.com/d/msg/web2py/Q1sf7DA5BL4/L4pkg-GMuzUJ> and >>> again here<https://groups.google.com/d/msg/web2py/j-_P7nkn_OY/e1TJGksh3XAJ> >>> Anthony >>> says: >>> >>> "You can define classes in models" >>> >>> So I'm looking for some clarification. I can't seem to find anything on >>> this in docs. Can someone point me to where this is discussed in the book, >>> or explain further? >>> >>> Is the rule: classes may *only* be defined in *modules*, or is it more >>> complicated than that? >>> >>> -- >>> >>> >>> >>> >> >> --

