Issue #3 resolved

Provide a decorator function for exposing methods

Anonymous created an issue

Not only in preparation for Python 2.4's new decorator syntax, CP2 should supply a decorator function that is used to mark methods as exposed through the web. Example:

{{{

!python

from CherryPy import cpg

class Page: def index(self): return "Hi!"

index = cpg.expose(index)

}}}

Reported by hendrik@mans.de

Comments (6)

  1. Anonymous

    In Python 2.4, you will be able to do this:

    from CherryPy import cpg
    
    class Page:
        @cpg.expose
        def index(self):
            return "Hi!"
    
  2. Log in to comment