#NEWLINE# @ classmethod #NEWLINE# def unix_logins( cls , membership = None , first_name = None , last_name = None , given_names = None ) : #NEWLINE# #INDENT# 'Returns a list of available user login names.' #NEWLINE# if membership : #NEWLINE# #INDENT# first_name = remove_accents ( membership . person . first_name . lower ( ) ) #NEWLINE# last_name = remove_accents ( membership . person . last_name . lower ( ) ) #NEWLINE# given_names = remove_accents ( membership . person . given_names . lower ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# first_name = remove_accents ( first_name . lower ( ) ) #NEWLINE# last_name = remove_accents ( last_name . lower ( ) ) #NEWLINE# given_names = remove_accents ( given_names . lower ( ) ) #NEWLINE# #UNINDENT# permutations = [ ] #NEWLINE# permutations . append ( last_name ) #NEWLINE# permutations . append ( first_name ) #NEWLINE# permutations . append ( ( first_name + last_name ) ) #NEWLINE# permutations . append ( ( last_name + n ) ) #NEWLINE# non_first_names = [ ] #NEWLINE# initials = [ ] #NEWLINE# for n in given_names . split ( ' ' ) : #NEWLINE# #INDENT# if ( n != first_name ) : #NEWLINE# #INDENT# non_first_names . append ( n ) #NEWLINE# initials . append ( n ) #NEWLINE# #UNINDENT# #UNINDENT# permutations . append ( ( '' . join ( initials ) + last_name [ 0 ] ) ) #NEWLINE# permutations . append ( ( '' . join ( initials ) + last_name ) ) #NEWLINE# for initial in initials : #NEWLINE# #INDENT# permutations . append ( ( initial + last_name ) ) #NEWLINE# #UNINDENT# return [ perm for perm in permutations if ( cls . objects . filter ( name__iexact = perm ) . count ( ) == 0 ) ]