On Sun, 2011-10-30 at 08:54 -0700, Anthony wrote:
> You can use the new thread local 'current' object. In your module
> file:
> 
> 
> from gluon import *
> def use_custom_view(viewname):
>     [snip]
>         current.response.view = '%s.%s' % (viewname,
> current.request.extension)
>     [snip]
> 
> 
> Also, note that local_import is no longer necessary -- now you can
> just do:
> 
> 
> import helpers

Nice! It did the job.

BTW, is there any way to automatically watch module files for changes
using inotify and reload() them automatically upon change, at least
during development? Many times it gets confusing when changes in modules
in the modules dir don't apply while changes in controllers etc. does..

Some times ago I created a similar mechanism for a PyQt4 application;
for what I remember I took some code from a CherryPy "autoreload"
component but http://www.cherrypy.org/wiki/AutoReload is a 404 and
http://docs.cherrypy.org/dev/progguide/autoreloader.html seems to work
using a clock instead of inotify to watch files, plus it relaunches
process instead of reload()ing modules.. 
-- 
Samuele ~redShadow~ Santi
----------------------------------------------------------------
     redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
       050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933
----------------------------------------------------------------
/me recommends:
    Squadra Informatica - http://www.squadrainformatica.com
----------------------------------------------------------------
 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
      * GENTOO User since 1199142000 (2008-01-01)
      * former DEBIAN SID user
----------------------------------------------------------------
      "Software is like sex: it's better when it's free!"
                              -- Linus Torvalds

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to