Decorators will only make thinks worse (because all decorators in the
same controller are still executed at ever request for any function in
the controller). importing should speed things a bit (i.e. move the
db.define_table in a function called in a module, importing the
module, calling the functi
I wonder if conditional model loading would be best performed with either
decorators or, dare I say it, importing (if either is even possible)?
So then my previous example for having two controllers access the same model
is still valid?
all files in
models/a/
are executed only for actions in controllers/a.py
all files in
models/a/b/
are executed only for actions b() in controllers/a.py
this is for every a and b.
On Aug 16, 1:14 pm, Ross Peoples wrote:
> I didn't know could share a model file between two controllers by simp
I didn't know could share a model file between two controllers by simply
adding another folder. That's pretty cool and "magic" like. Would this work
with a third controller as well?
Like if you have 'address_book', 'mail', and 'calendar' controllers all
needing to access a single model by doing
The model is loaded at every request.
Instead of this
> if request.controller == 'mail' or request.controller == 'address_book':
> db.define_table('contact',
> Field('name'),
>
> )
you can just put this
> db.define_table('contact',
> Field('name'),
>
If I recall correctly, from my testing, the model is only really loaded once
the first time the app is accessed. So Massimo is correct that loading is
not the issue. The issue is that the model needs to be executed for every
request, so breaking your models up will really help with this. Also, y
The problem is not loading. The time is spend in execution. If there
is a lot of logic in models and it is not conditional it must be
executed.
On Aug 16, 10:58 am, Jay wrote:
> Massimo,
>
> Would it be possible to only load db.py if it has changed and when
> changed generate a python object tha
Massimo,
Would it be possible to only load db.py if it has changed and when
changed generate a python object that is the db, and save/load it as
required? I know it would work, But would it be too slow? Slower then
running all of db.py.
I am looking at using web2py to write a small ERP like app
I would suggest you move some tables to conditional models.
If you have a lot of
Field(,requires=IS_NO_EMPTY())
you can
ne = IS_NO_EMPTY()
and then reuse the same object
Field(,requires=ne)
You can do this for all validators.
Set defaults in controllers if complex.
you may want to do
Very interesting reading Anthony - thanks for the link.
Kevin
On Aug 15, 6:27 pm, Anthony wrote:
> This thread from the developers list a few months ago may interest
> you:https://groups.google.com/d/topic/web2py-developers/rYKg1TUXem0/discu...
>
> Anthony
>
>
>
>
>
>
>
> On Monday, August 15,
This thread from the developers list a few months ago may interest you:
https://groups.google.com/d/topic/web2py-developers/rYKg1TUXem0/discussion
Anthony
On Monday, August 15, 2011 8:18:30 PM UTC-4, Kevin Ivarsen wrote:
> Hi Anthony,
>
> Thanks for the quick response.
>
> I do use migrate=F
Hi Anthony,
Thanks for the quick response.
I do use migrate=False already. I have not tried bytecode compiling
the app, but earlier today I did a quick test: I wrapped the contents
of my long db.py in an "if False:" block (causing it to compile, but
not run, the code for each request), and compar
First, have you set migrate to False for all tables, and have you bytecode
compiled the app? That should speed things up.
Also, do you need all 70 tables for any requests, or can they be broken up
based on the particular controller/function called? If so, you may speed
things up with condition
14 matches
Mail list logo