def administrator(method):
 @functools.wraps(method)
 def wrapper(self, *args, **kwargs):
  if (not self.current_user):
   if (self.request.method == 'GET'):
    self.redirect(self.get_login_url())
    return
   raise tornado.web.HTTPError(403)
  elif (not self.current_user.administrator):
   if (self.request.method == 'GET'):
    self.redirect('/')
    return
   raise tornado.web.HTTPError(403)
  else:
   return method(self, *args, **kwargs)
 return wrapper

def administrator ( method ) : @ functools . wraps ( method ) def wrapper ( self , * args , ** kwargs ) : if ( not self . current_user ) : if ( self . request . method == 'GET' ) : self . redirect ( self . get_login_url ( ) ) return raise tornado . web . HTTPError ( 403 ) elif ( not self . current_user . administrator ) : if ( self . request . method == 'GET' ) : self . redirect ( '/' ) return raise tornado . web . HTTPError ( 403 ) else : return method ( self , * args , ** kwargs ) return wrapper
decorate with this method to restrict to site admins .