(domain, data, email)
Emails the requester with an excel file translations to be sent to Transifex.

    Used to verify translations before sending to Transifex
Emails the requester with an excel file translations to be sent to Transifex.
Emails the requester with an excel file translations to be sent to Transifex .
def email_project_from_hq(domain, data, email):
    """Emails the requester with an excel file translations to be sent to Transifex.

    Used to verify translations before sending to Transifex
    """
    lang = data.get('source_lang')
    project_slug = data.get('transifex_project_slug')
    quacks_like_a_transifex = AppTranslationsGenerator(domain, data.get('app_id'), data.get('version'),
                                                       key_lang=lang, source_lang=lang, lang_prefix='default_')
    parser = TranslationsParser(quacks_like_a_transifex)
    try:
        translation_file, __ = parser.generate_excel_file()
        with open(translation_file.name, 'rb') as file_obj:
            email = EmailMessage(
                subject='[{}] - HQ translation download'.format(settings.SERVER_ENVIRONMENT),
                body="Translations from HQ",
                to=[email],
                from_email=settings.DEFAULT_FROM_EMAIL)
            filename = "{project}-{lang}-translations.xls".format(project=project_slug, lang=lang)
            email.attach(filename=filename, content=file_obj.read())
            email.send()
    finally:
        try:
            os.remove(translation_file.name)
        except (NameError, OSError):
            pass
def email_project_from_hq ( domain , data , email ) : lang = data . get ( 'source_lang' ) project_slug = data . get ( 'transifex_project_slug' ) quacks_like_a_transifex = AppTranslationsGenerator ( domain , data . get ( 'app_id' ) , data . get ( 'version' ) , key_lang = lang , source_lang = lang , lang_prefix = 'default_' ) parser = TranslationsParser ( quacks_like_a_transifex ) try : translation_file , __ = parser . generate_excel_file ( ) with open ( translation_file . name , 'rb' ) as file_obj : email = EmailMessage ( subject = '[{}] - HQ translation download' . format ( settings . SERVER_ENVIRONMENT ) , body = "Translations from HQ" , to = [ email ] , from_email = settings . DEFAULT_FROM_EMAIL ) filename = "{project}-{lang}-translations.xls" . format ( project = project_slug , lang = lang ) email . attach ( filename = filename , content = file_obj . read ( ) ) email . send ( ) finally : try : os . remove ( translation_file . name ) except ( NameError , OSError ) : pass