On Jun 11, 10:08 pm, DenesL <[email protected]> wrote:
> Using the common code in the controller as a model substitute?
> There goes the MVC separation.
> And the other models still get executed.
>
> I think AchipA means execute one model only.
> The problem is that models are executed before controllers (aren't
> they?), but then this points back to using ifs in models as suggested
> by Massimo.
Not quite. I recommend we do the same as we do with views. E.g. if I'm
in a stuff.py controller, then
a) if there is no stuff.py in models, we include all models,
convenient for development, friendly to newbies
b) if there IS a stuff.py in models, we include ONLY that, and that
model file is responsible for it's dependencies - see below.
> Let's suppose we change that.
> Where do you keep common model code?
> common = used by all ctls, except those with a name
Now, for the kicker - in the model we could do an equivalent of
{{extend 'layout.html'}} (=sort of import ?) to include any
dependencies. This would also pull in any 'common' models (just like
we do with layout.html). Note the subtle difference - I don't want a
single EXTRA model to be included - I want to avoid loading
unnecessary models.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---