Applying a decorator to a module

lkcl luke.leighton at googlemail.com
Thu Nov 27 20:33:17 CET 2008


Very simple question: how do you apply a decorator to an entire
module?  an idea whose time has properly arrived is to merge pyjamas
(http://pyjs.org) into web2py (http://web2py.com), and to do that,
it's necessary to "identify" functions, classes, global variables and
modules that should be compiled into javascript, rather than executed
server-side.

i figured that the best pythonic way would be to put a decorator on an
entire module, if the entire module was to be compiled to javascript.

... however, i don't know how to do that!

@decorate(module) ?

@decorator()
import modulename

?

should this work?

many thanks,

l.



More information about the Python-list mailing list