Example #1
0
def export_event_task(self, email, event_id, settings):
    event = safe_query(Event, 'id', event_id, 'event_id')
    smtp_encryption = get_settings()['smtp_encryption']
    try:
        logging.info('Exporting started')
        path = event_export_task_base(event_id, settings)
        # task_id = self.request.id.__str__()  # str(async result)
        download_url = path

        result = {'download_url': download_url}

        logging.info('Exporting done.. sending email')
        if check_smtp_config(smtp_encryption):
            send_export_mail(
                email=email, event_name=event.name, download_url=download_url
            )
        else:
            logging.warning('Error in sending export success email')
    except Exception as e:
        result = {'__error': True, 'result': str(e)}
        logging.warning('Error in exporting.. sending email')
        if check_smtp_config(smtp_encryption):
            send_export_mail(email=email, event_name=event.name, error_text=str(e))
        else:
            logging.warning('Error in sending export error email')
    return result
Example #2
0
def export_event_task(self, email, event_id, settings):
    event = safe_query(db, Event, 'id', event_id, 'event_id')
    user = db.session.query(User).filter_by(email=email).first()
    try:
        logging.info('Exporting started')
        path = event_export_task_base(event_id, settings)
        # task_id = self.request.id.__str__()  # str(async result)
        download_url = path

        result = {'download_url': download_url}
        logging.info('Exporting done.. sending email')
        send_export_mail(email=email,
                         event_name=event.name,
                         download_url=download_url)
        send_notif_after_export(user=user,
                                event_name=event.name,
                                download_url=download_url)
    except Exception as e:
        result = {'__error': True, 'result': str(e)}
        logging.warning('Error in exporting.. sending email')
        send_export_mail(email=email, event_name=event.name, error_text=str(e))
        send_notif_after_export(user=user,
                                event_name=event.name,
                                error_text=str(e))

    return result
Example #3
0
def export_event_task(self, email, event_id, settings):
    event = safe_query(db, Event, 'id', event_id, 'event_id')
    user = db.session.query(User).filter_by(email=email).first()
    try:
        logging.info('Exporting started')
        path = event_export_task_base(event_id, settings)
        # task_id = self.request.id.__str__()  # str(async result)
        download_url = path

        result = {
            'download_url': download_url
        }
        logging.info('Exporting done.. sending email')
        send_export_mail(email=email, event_name=event.name, download_url=download_url)
        send_notif_after_export(user=user, event_name=event.name, download_url=download_url)
    except Exception as e:
        print(traceback.format_exc())
        result = {'__error': True, 'result': str(e)}
        logging.info('Error in exporting.. sending email')
        send_export_mail(email=email, event_name=event.name, error_text=str(e))
        send_notif_after_export(user=user, event_name=event.name, error_text=str(e))

    return result