On Oct 16, 3:05 am, Christopher Arndt <[email protected]> wrote:
> Can you give a more complete code example of what you are trying to do?
> I believe that these functions are not decorators but *generate* decorators.
I've been using my own custom lightweight auth system for years...
I was just curious what the last line does.
I thought any function that returned a function was *already* a
decorator!?
def access_control(function):
"""
Decorator that denies access without authentication.
"""
def new_function(function, *parameters, **keywords):
"""
Adds a wrapper requiring authentication.
"""
if ("logged_in" in cherrypy.session)
and \
cherrypy.session["logged_in"]:
return function(*parameters, **keywords)
else:
raise turbogears.redirect("/access_control_/
log_in")
return new_function
access_control = turbogears.decorator.decorator(access_control)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---