Hi Massimo,

I've just did few experiments and it works without reloading.. has
web2py changed in some way regarding the importing of modules ?

when is it necessary to use "reload" ?

thanks

"welcome/modules/mymodule.py"
from gluon.html import *
from gluon.http import *
from gluon.validators import *
from gluon.sqlhtml import *
# request, response, session, cache, T, db(s) must be passed and
cannot be imported!

class MyClass():
    def myMethod(self):
        return 'from MyClass.myMethod 3 edition'

"welcome/controllers/default.py"
from applications.welcome.modules.mymodule import MyClass

def index():
    myObj = MyClass()
    response.flash = myObj.myMethod()
    return dict(message=T('Hello World'))

On Jan 21, 7:45 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> On Jan 21, 3:14 pm, "b-global.net" <bglobal...@yahoo.com.mx> wrote:
>
>
>
> > Hi Massimo:
>
> > Thank you for all your help!!!
>
> > Now, I have other problem!!! When I modify the importedmodule, the
> > application use the oldmodule, then I read that I can use:
>
> >  reload(module)
>
> > But I received an error!!!
>
> > this is my code:
>
> > exec('from applications.blog.modules.modulotest2 import MyModulo')
> >reload(MyModulo)
>
> > This is the error:
>
> >  reload(MyModulo)
> > TypeError:reload() argument must bemodule
>
> I think you need to do
>
> exec('import applications.blog.modules.modulotest2 as 
> modulotest2')reload(modulotest2)
>
> then use modulotest2.MyModulo
>
> > Other question:
>
> > I read that you must not usereload() in production, because will take
> > more time to execute, I'm right?
>
> > But, for example if I make a forummoduleand I imported to my
> > application, and everything works fine, but then I update this forum
> >module, what I can do to make my application use the updatedmodule
> > withoutreload?
>
> The easy way is just to commentreloadin production since you will
> not be changing the code then.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to