Re: [web2py] Re: New importer in trunk

2011-05-18 Thread Martín Mulone
Use it like a helper.

in a module I have:
(this fail because LOAD is not passed in current and loadfactory need
enviroment)

def renderimages(self, page=1, postid=0):curvars = {}
  curvars['page']=pagecurvars['postid']=postid
   return LOAD('plugin_i2padmin', 'imageslist.load',
vars=curvars, ajax=True)


in a view:


{{=current.myapp.mymodule.renderimages(page,postid)}}


I know you are going to say use directly the load in a view, but sometimes
the things get more complex than this example.

2011/5/17 Massimo Di Pierro 

> What do you want to do exactly with LOAD in modules?
>
> On May 17, 1:36 pm, Martín Mulone  wrote:
> > Pierreth I'm testing this, and it all seem to work very well, nice
> feature
> > indeed!. I'm looking for memory leak but it's seem stable in my notebook.
> I
> > already rewrite powerpack, to support this, at first sigth it's double
> the
> > speed from the old way putting all in models (I have many models). So I'm
> > waiting to be stable. Also I'm waiting an answer on how can I use the
> LOAD()
> > in modules.
> >
> > 2011/5/17 pierreth 
> >
> > > It would be nice to have feedback to know if the new feature is
> > > working well for you. Tell me if everything is OK or not.
> >
> > --
> >  http://martin.tecnodoc.com.ar
>



-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: New importer in trunk

2011-05-17 Thread pierreth
On 17 mai, 14:36, Martín Mulone  wrote:
> Pierreth I'm testing this, and it all seem to work very well, nice feature
> indeed!.

:-)

>I'm looking for memory leak but it's seem stable in my notebook. I
> already rewrite powerpack, to support this, at first sigth it's double the
> speed from the old way putting all in models (I have many models).

Indeed, models are run at each request. This can be very time
consuming. Moving everything in modules that does not need to be run
each request is a good idea.


[web2py] Re: New importer in trunk

2011-05-17 Thread Massimo Di Pierro
What do you want to do exactly with LOAD in modules?

On May 17, 1:36 pm, Martín Mulone  wrote:
> Pierreth I'm testing this, and it all seem to work very well, nice feature
> indeed!. I'm looking for memory leak but it's seem stable in my notebook. I
> already rewrite powerpack, to support this, at first sigth it's double the
> speed from the old way putting all in models (I have many models). So I'm
> waiting to be stable. Also I'm waiting an answer on how can I use the LOAD()
> in modules.
>
> 2011/5/17 pierreth 
>
> > It would be nice to have feedback to know if the new feature is
> > working well for you. Tell me if everything is OK or not.
>
> --
>  http://martin.tecnodoc.com.ar


Re: [web2py] Re: New importer in trunk

2011-05-17 Thread Martín Mulone
Pierreth I'm testing this, and it all seem to work very well, nice feature
indeed!. I'm looking for memory leak but it's seem stable in my notebook. I
already rewrite powerpack, to support this, at first sigth it's double the
speed from the old way putting all in models (I have many models). So I'm
waiting to be stable. Also I'm waiting an answer on how can I use the LOAD()
in modules.

2011/5/17 pierreth 

> It would be nice to have feedback to know if the new feature is
> working well for you. Tell me if everything is OK or not.




-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: New importer in trunk

2011-05-17 Thread pierreth
It would be nice to have feedback to know if the new feature is
working well for you. Tell me if everything is OK or not.


[web2py] Re: New importer in trunk

2011-05-16 Thread villas
Yes, I think that would be a good idea.  Maybe there is already a
similar way to do that?

On May 17, 12:38 am, pierreth  wrote:
> Would it be better as a command line argument for webp2y.py?
> Something like:
> python web2py.py --debug
> ?


[web2py] Re: New importer in trunk

2011-05-16 Thread pierreth
Would it be better as a command line argument for webp2y.py?

Something like:

python web2py.py --debug

?


[web2py] Re: New importer in trunk

2011-05-16 Thread villas
Tip: get the value of the URL and set the Debug accordingly from
that,  it makes it easier if you don't have to remember changing the
flag.

Have a look at this, for example:
request.env.http_host.split('.')[0]


On May 16, 6:15 pm, Ross Peoples  wrote:
> I was thinking about setting this in a db.py file or something to indicate
> that the app in in debug mode. Then before deploying, setting this to false.
> Also allowing controllers, modules, etc to access the value of this might be
> beneficial. It could be a master 'debug' switch for an entire application.
> It could be like using a DEBUG preprocessor directive, allowing you to write
> code that works differently when in debug mode for testing purposes.


[web2py] Re: New importer in trunk

2011-05-16 Thread Ross Peoples
I was thinking about setting this in a db.py file or something to indicate 
that the app in in debug mode. Then before deploying, setting this to false. 
Also allowing controllers, modules, etc to access the value of this might be 
beneficial. It could be a master 'debug' switch for an entire application. 
It could be like using a DEBUG preprocessor directive, allowing you to write 
code that works differently when in debug mode for testing purposes. 

[web2py] Re: New importer in trunk

2011-05-16 Thread pierreth
On 16 mai, 11:08, Ross Peoples  wrote:
> I haven't actually tried this yet, but couldn't you do something like this
> to turn it off/on:
>
> import gluon custom_import
> custom_import.DEBUG = False

You can do:

from gluon import custom_import
custom_import.DEBUG = False

But right now it won't change the importer by doing this. Would you
like to be able to switch in a similar fashion?

We can also add the switch in the web interface I guess.


[web2py] Re: New importer in trunk

2011-05-16 Thread Ross Peoples
I haven't actually tried this yet, but couldn't you do something like this 
to turn it off/on:

import gluon custom_import
custom_import.DEBUG = False