[web2py] Re: Layout of functions with the MVC environment

2010-06-08 Thread Yarko Tymciurak
On Jun 8, 6:27 am, eddie wrote: > I've been considering some issues related to this. Where do people > tend to locate their functions they are calling from controllers? You can locate controller specific functions in your controller file; > > Obviously the simplest place is as a function defined

[web2py] Re: Layout of functions with the MVC environment

2010-06-08 Thread eddie
I've been considering some issues related to this. Where do people tend to locate their functions they are calling from controllers? Obviously the simplest place is as a function defined in the same controller python file as where it is called from. But some down sides to this are: * You end up w

Re: [web2py] Re: Layout of functions with the MVC environment

2010-06-04 Thread Thadeus Burgess
All functions defined in models are available to controllers and views as anything you put in the models becomes part of the global namespace that the controllers/views are executed in. This leads to potential problems of namespace collision. Make sure you do not overwrite the function elsewhere,

Re: [web2py] Re: Layout of functions with the MVC environment

2010-06-04 Thread Doug Warren
On Fri, Jun 4, 2010 at 9:11 AM, Yarko Tymciurak wrote: > > > On Jun 4, 10:58 am, Doug Warren wrote: >> I don't believe I want to local_import my db.py file as it's already >> set up by the environment correct? > > Correct - you do not want / need to import your db.py. > > As long as it is in your

[web2py] Re: Layout of functions with the MVC environment

2010-06-04 Thread Yarko Tymciurak
On Jun 4, 10:58 am, Doug Warren wrote: > I don't believe I want to local_import my db.py file as it's already > set up by the environment correct? Correct - you do not want / need to import your db.py. As long as it is in your models folder (by default it is), it's already in your request cont

Re: [web2py] Re: Layout of functions with the MVC environment

2010-06-04 Thread Doug Warren
I don't believe I want to local_import my db.py file as it's already set up by the environment correct? What I'm asking for is a way to keep all of the code that relates to the model in one place and to invoke it from controllers. That is if I define 5 tables for the model I'd expect to write hel

[web2py] Re: Layout of functions with the MVC environment

2010-06-04 Thread Yarko Tymciurak
On Jun 4, 10:43 am, Doug Warren wrote: > Traditionally when I've written MVC style applications, the model > would contain not only the data representing the objects but also the > data for manipulating the objects.  I'm not sure how that same > relation applies to web2py. > > If I have a model