Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >Gert Cuykens a écrit : >>> FWIW, the first version raises an exception (unless of course the name >>> 'index' is already bound in the enclosing scope). And the second won't >>> probably work as expected with CherryPy. >> >> <code> >> class HelloWorld: >> def index(self): >> return "Hello world!" >> index.exposed = True #DOOOOOOH! > >And the winner is.... > >> </code> > >The whole thing, I guess. While Python is quite easy to get started >with, there are a few gotchas. You're above snippet should be: > >class HelloWorld(object): > def index(self): > return "Hello World" > index.exposed = True
Many people find it more readable to write that as: class HelloWorld(object): @cherrypy.exposed def index(self): return "Hello World" I haven't decided yet. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list