#NEWLINE# def create( self , user ) : #NEWLINE# #INDENT# 'Create a new user by storing it as JSON on the file system.' #NEWLINE# user_file = self . _get_user_file ( user . name ) #NEWLINE# if os . path . exists ( user_file ) : #NEWLINE# #INDENT# raise UserStorageError ( 'A user with that name already exists.' ) #NEWLINE# #UNINDENT# if ( self . find_by_email ( user . email ) is not None ) : #NEWLINE# #INDENT# raise UserStorageError ( 'A user with that email already exists.' ) #NEWLINE# #UNINDENT# user . user_id = self . _generate_user_id ( ) #NEWLINE# self . _write_json ( self . __dict__ , user_file ) #NEWLINE# self . _update_indices ( user , user_file )