<s> """<STR_LIT>""" <EOL> from google . appengine . api import users <EOL> def required ( handler_method ) : <EOL> """<STR_LIT>""" <EOL> def check_login ( self , * args , ** kwargs ) : <EOL> user = users . get_current_user ( ) <EOL> if user is None : <EOL> return self . redirect ( users . create_login_url ( self . request . path ) ) <EOL> return handler_method ( self , * args , ** kwargs ) <EOL> return check_login <EOL> def admin ( handler_method ) : <EOL> """<STR_LIT>""" <EOL> def check_admin ( self , * args , ** kwargs ) : <EOL> user = users . get_current_user ( ) <EOL> if user is None : <EOL> return self . redirect ( users . create_login_url ( self . request . path ) ) <EOL> elif not users . is_current_user_admin ( ) : <EOL> return self . error ( status = <NUM_LIT> ) <EOL> return handler_method ( self , * args , ** kwargs ) <EOL> return check_admin </s>
