Skip to content

Instantly share code, notes, and snippets.

@ZSchneidi
Created August 7, 2012 12:48
Show Gist options
  • Save ZSchneidi/3285033 to your computer and use it in GitHub Desktop.
Save ZSchneidi/3285033 to your computer and use it in GitHub Desktop.
deco
def login_required(self,fn):
def wrapped():
session = request.environ.get('beaker.session')
if session.get("user",0):
return fn()
else:
return redirect("/login")
return wrapped
@self.login_required
@self.app.route('/')
def index():
gc.collect()
return template('index', request=request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment