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)?
>
>

Reply via email to