#NEWLINE# def get( self , name = None ) : #NEWLINE# #INDENT# cutoff = int ( self . get_argument ( 'cutoff' , 100 ) ) #NEWLINE# include_role_users = ( self . get_argument ( 'include_role_users' , 'no' ) == 'yes' ) #NEWLINE# with self . graph . lock : #NEWLINE# #INDENT# if ( not name ) : #NEWLINE# #INDENT# return self . success ( { #NEWLINE# #INDENT# 'users' : sorted ( [ k for ( k , v ) in self . graph . user_metadata . iteritems ( ) if ( include_role_users or ( not v [ 'role_user' ] ) ) ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if ( name in self . graph . user_metadata ) : #NEWLINE# #INDENT# md = self . graph . user_metadata [ name ] #NEWLINE# details = self . graph . get_user_details ( name , cutoff ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return self . notfound ( ( 'User (%s) not found.' % name ) ) #NEWLINE# #UNINDENT# out = { #NEWLINE# #INDENT# 'user' : { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# try_update ( out [ 'user' ] , md ) #NEWLINE# try_update ( out , details ) #NEWLINE# return self . success ( out )