def admin_or_self(method):
 def m(self, name):
  current = self.get_current_user()
  if (current is None):
   raise web.HTTPError(403)
  if (not ((current.name == name) or current.admin)):
   raise web.HTTPError(403)
  if (not self.find_user(name)):
   raise web.HTTPError(404)
  return method(self, name)
 return m

def admin_or_self ( method ) : def m ( self , name ) : current = self . get_current_user ( ) if ( current is None ) : raise web . HTTPError ( 403 ) if ( not ( ( current . name == name ) or current . admin ) ) : raise web . HTTPError ( 403 ) if ( not self . find_user ( name ) ) : raise web . HTTPError ( 404 ) return method ( self , name ) return m
decorator for restricting access to either the target service or admin .