def require_permission(level=None):
 def decorator(f):
  @gen.engine
  def wrapper(self, *args, **kwargs):
   assert (level in [None, 'root', 'support'])
   self._permissions = (yield gen.Task(self.QueryAdminPermissions))
   if (level == 'root'):
    self.CheckIsRoot()
   elif (level == 'support'):
    self.CheckIsSupport()
   f(self, *args, **kwargs)
  return wrapper
 return decorator

def require_permission ( level = None ) : def decorator ( f ) : @ gen . engine def wrapper ( self , * args , ** kwargs ) : assert ( level in [ None , 'root' , 'support' ] ) self . _permissions = ( yield gen . Task ( self . QueryAdminPermissions ) ) if ( level == 'root' ) : self . CheckIsRoot ( ) elif ( level == 'support' ) : self . CheckIsSupport ( ) f ( self , * args , ** kwargs ) return wrapper return decorator
decorator to be used in admin get/post methods .