On Aug18, 11:37pm, rev <reneversch...@gmail.com> wrote: > Hi, > > I have some code that are 'helper' functions for a controller. > Instead of putting this code in the controller I'd like to structure > things a bit. > So I placed the functions in modules/utils.py. > One of the functions is called doit(). > In my controller I added > exec('from applications.%s.modules.utils import doit' % > request.application) > and now I can call the function from my controller by simply calling > doit(). > > When I make changes to the code in utils.py I have to completely stop > and start web2py to have the changes take effect. > For a small change that's ok, but while in heavy development it tends > to get pretty annoying. > > Is there a way to work around this? > In another thread it was suggested that reload() would do the trick, > but I couldn't get that working. > > Cheers, > rev
Neither me. Meanwhile my temporary solution is to put my modules inside model during development phase, and move them back to modules when the code is finalized. Not a perfect solution but helps a bit. try: exec("from applications.%s.modules.mymodule import MyStuff" % request.application) except: pass # Assuming it is available as a model Regards, Iceberg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" 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 -~----------~----~----~----~------~----~------~--~---