def _notify_error_user(email_user, original_filename, recid, submission_title, ln=invenio.config.CFG_SITE_LANG): """Sends an error notification to the specified addres of the user. Is called by process_batch_job() if an error occured during the processing. @param email_user: email address of the user @type email_user: string @param email_admin: email address of the admin @type email_admin: string """ if not email_user: return uid = emailUnique(email_user) if uid != -1 and uid != 0: language = getval(get_user_preferences(uid), "language") if language: ln = language _ = gettext_set_language(ln) rec_url = invenio.config.CFG_SITE_URL + "/record/" + str(recid) template = ( "<br/>" + _("We are sorry, a problem has occured during the processing of" " your video upload%(submission_title)s.") + "<br/><br/>" + _("The file you uploaded was %(input_filename)s.") + "<br/><br/>" + _("Your video might not be fully available until intervention.") + "<br/>" + _("You can check the status of your video here: %(record_url)s.") + "<br/>" + _("You might want to take a look at " " %(guidelines_url)s" " and modify or redo your submission.")) text = template % { "input_filename": "%s" % original_filename, "submission_title": " %s" % submission_title, "record_url": "%s" % rec_url, "guidelines_url": "localhost" } text = text.replace("<br/>", "\n") html_text = template % { "input_filename": "<strong>%s</strong>" % original_filename, "submission_title": " <strong>%s</strong>" % submission_title, "record_url": "<a href=\"%s\">%s</a>" % (rec_url, rec_url), "guidelines_url": "<a href=\"locahost\">%s</a>" % _("the video guidelines") } send_email(fromaddr=invenio.config.CFG_SITE_ADMIN_EMAIL, toaddr=email_user, subject="Problem during the processing of your video", content=text, html_content=html_text)
def _notify_error_user(email_user, original_filename, recid, submission_title, ln=invenio.config.CFG_SITE_LANG): """Sends an error notification to the specified addres of the user. Is called by process_batch_job() if an error occured during the processing. @param email_user: email address of the user @type email_user: string @param email_admin: email address of the admin @type email_admin: string """ if not email_user: return uid = emailUnique(email_user) if uid != -1 and uid != 0: language = getval(get_user_preferences(uid), "language") if language: ln = language _ = gettext_set_language(ln) rec_url = invenio.config.CFG_SITE_URL + "/record/" + str(recid) template = ( "<br/>" + _("We are sorry, a problem has occured during the processing of" " your video upload%(submission_title)s.") + "<br/><br/>" + _("The file you uploaded was %(input_filename)s.") + "<br/><br/>" + _("Your video might not be fully available until intervention.") + "<br/>" + _("You can check the status of your video here: %(record_url)s.") + "<br/>" + _("You might want to take a look at " " %(guidelines_url)s" " and modify or redo your submission.") ) text = template % { "input_filename": "%s" % original_filename, "submission_title": " %s" % submission_title, "record_url": "%s" % rec_url, "guidelines_url": "localhost", } text = text.replace("<br/>", "\n") html_text = template % { "input_filename": "<strong>%s</strong>" % original_filename, "submission_title": " <strong>%s</strong>" % submission_title, "record_url": '<a href="%s">%s</a>' % (rec_url, rec_url), "guidelines_url": '<a href="locahost">%s</a>' % _("the video guidelines"), } send_email( fromaddr=invenio.config.CFG_SITE_ADMIN_EMAIL, toaddr=email_user, subject="Problem during the processing of your video", content=text, html_content=html_text, )
def _notify_success_user(email_user, original_filename, recid, submission_title, ln=invenio.config.CFG_SITE_LANG): """Sends an success notification to the specified addres of the user. Is called by process_batch_job() if the processing was successfull. @param email_user: email address of the user @type email_user: string @param email_admin: email address of the admin @type email_admin: string """ uid = emailUnique(email_user) if uid != -1 and uid != 0: language = getval(get_user_preferences(uid), "language") if language: ln = language _ = gettext_set_language(ln) rec_url = invenio.config.CFG_SITE_URL + "/record/" + str(recid) template = ( "<br/>" + _("Your video submission%(submission_title)s was successfully processed.") + "<br/><br/>" + _("The file you uploaded was %(input_filename)s.") + "<br/><br/>" + _("Your video is now available here: %(record_url)s.") + "<br/>" + _( "If the videos quality is not as expected, you might want to take " "a look at %(guidelines_url)s" " and modify or redo your submission." ) ) text = template % { "input_filename": "%s" % original_filename, "submission_title": " %s" % submission_title, "record_url": "%s" % rec_url, "guidelines_url": "localhost", } text = text.replace("<br/>", "\n") html_text = template % { "input_filename": "<strong>%s</strong>" % original_filename, "submission_title": " <strong>%s</strong>" % submission_title, "record_url": '<a href="%s">%s</a>' % (rec_url, rec_url), "guidelines_url": '<a href="locahost">%s</a>' % _("the video guidelines"), } send_email( fromaddr=invenio.config.CFG_SITE_ADMIN_EMAIL, toaddr=email_user, subject="Your video submission is now complete", content=text, html_content=html_text, )
def _notify_success_user(email_user, original_filename, recid, submission_title, ln=invenio.config.CFG_SITE_LANG): """Sends an success notification to the specified addres of the user. Is called by process_batch_job() if the processing was successfull. @param email_user: email address of the user @type email_user: string @param email_admin: email address of the admin @type email_admin: string """ uid = emailUnique(email_user) if uid != -1 and uid != 0: language = getval(get_user_preferences(uid), "language") if language: ln = language _ = gettext_set_language(ln) rec_url = invenio.config.CFG_SITE_URL + "/record/" + str(recid) template = ( "<br/>" + _("Your video submission%(submission_title)s was successfully processed." ) + "<br/><br/>" + _("The file you uploaded was %(input_filename)s.") + "<br/><br/>" + _("Your video is now available here: %(record_url)s.") + "<br/>" + _("If the videos quality is not as expected, you might want to take " "a look at %(guidelines_url)s" " and modify or redo your submission.")) text = template % { "input_filename": "%s" % original_filename, "submission_title": " %s" % submission_title, "record_url": "%s" % rec_url, "guidelines_url": "localhost" } text = text.replace("<br/>", "\n") html_text = template % { "input_filename": "<strong>%s</strong>" % original_filename, "submission_title": " <strong>%s</strong>" % submission_title, "record_url": "<a href=\"%s\">%s</a>" % (rec_url, rec_url), "guidelines_url": "<a href=\"locahost\">%s</a>" % _("the video guidelines") } send_email(fromaddr=invenio.config.CFG_SITE_ADMIN_EMAIL, toaddr=email_user, subject="Your video submission is now complete", content=text, html_content=html_text)