CherryPy decorators question

3 messages in this thread from Chicago Python Uers Group in 2009-02

  1.   Daniel Griffin <dgriff1@gm...com> 02-27 16:35
  2.   Augie Fackler <lists@du...com> 02-27 17:19
  3.   Daniel Griffin <dgriff1@gm...com> 02-27 17:22

Daniel Griffin <dgriff1@gm...com>

2009-02-27 16:35:04
Replies: Augie Fackler
_______________________________________________
Chicago mailing list
Chicago@py...org
http://mail.python.org/mailman/listinfo/chicago

Augie Fackler <lists@du...com>

2009-02-27 17:19:29
On Feb 27, 2009, at 10:35 AM, Daniel Griffin wrote:

> Hi,
>
> I am a bit confused about decorators in cherrypy and was hoping  
> someone could help me. I am trying to add a decorator to some pages  
> to deal with security stuff but when I add them I break the  
> decorators that expose the methods. I think im doing something wrong  
> syntactically.
>
> def auth(func):
>      print "some stuff"
Your decorator needs to return a callable - in this case, probably func.


> class .....
>
> @auth
> def index(self):
>       return some template
> index.exposed = True
>
> Python complains that one or the other is broken and im pretty  
> confused about why there seems to be 2 different syntaxes.
>
> Thanks,
> Dan
> _______________________________________________
> Chicago mailing list
> Chicago@py...org
> http://mail.python.org/mailman/listinfo/chicago
_______________________________________________
Chicago mailing list
Chicago@py...org
http://mail.python.org/mailman/listinfo/chicago

Daniel Griffin <dgriff1@gm...com>

2009-02-27 17:22:16
_______________________________________________
Chicago mailing list
Chicago@py...org
http://mail.python.org/mailman/listinfo/chicago

3 messages in this thread from Chicago Python Uers Group in 2009-02