in Java (say for example Java EE 6), you would have your own Classes
hierarchy (as extended as needed), and then you would inject what you need
in your "controllers" (backing beans)...  in web2py you can do exactly the
same. Create your own hierarchy of classes (as extended as needed) and then
just import the modules that you need in your controllers....

On Sun, May 13, 2012 at 7:07 PM, Yarin <ykess...@gmail.com> wrote:

> That's what I've already been doing, but making decisions in the model on
> which code to run based on the request controller turns into a hot mess of
> distributed logic and violates the most basic principles of MVC (Models
> knowing about Controllers?)
>
>
> On Sunday, May 13, 2012 1:58:25 PM UTC-4, simon wrote:
>>
>> You can put common controller functionality in the model. This is
>> executed on each request before the controllers. You can check which
>> controller is called in request.controller.
>>
>> On Sunday, 13 May 2012 17:31:22 UTC+1, Yarin wrote:
>>>
>>> I've always liked the idea of controllers as classes, allowing for
>>> subclassing of controllers, and thereby providing an easy means of handling
>>> common controller functionality. I'm curious as to why web2py didn't follow
>>> this approach? Is there a recommended way of handling code that is common
>>> to a group of controllers (besides sticking it at the top of a controller
>>> file)?
>>
>>


-- 
Sebastian E. Ovide

Reply via email to