#NEWLINE# def email( src_dir , pattern , email_name , locale = None ) : #NEWLINE# #INDENT# '\n    Gets an email by name. Used for clients which should produce a single file for all locales.\n\n    :param src_dir: base dir for the search\n    :param pattern: search pattern\n    :param email_name: email name\n    :param locale: locale name or None for all locales\n\n    :returns: generator for the emails with email_name\n    ' #NEWLINE# single_email_pattern = pattern . replace ( '{name}' , email_name ) #NEWLINE# if locale : #NEWLINE# #INDENT# single_email_pattern = single_email_pattern . replace ( '{locale}' , locale ) #NEWLINE# #UNINDENT# params = _parse_params ( pattern ) #NEWLINE# for result in _emails ( src_dir , single_email_pattern , locale ) : #NEWLINE# #INDENT# result . named [ 'name' ] = email_name #NEWLINE# if locale : #NEWLINE# #INDENT# result . named [ 'locale' ] = locale #NEWLINE# #UNINDENT# ( yield Email ( ** result . named ) )