Skip to content

Commit

Permalink
Merge pull request #4 from weareasterisk/mkhatri-email-fix
Browse files Browse the repository at this point in the history
Email bug hotfix
  • Loading branch information
mkhatri1 authored Oct 11, 2019
2 parents 5e52ee9 + 382d9aa commit 48fc6c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
worker: celery -A gavel:celery worker
web: python initialize.py && gunicorn gavel:app -w 3 -t 3
web: python initialize.py && gunicorn gavel:app
3 changes: 2 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"EMAIL_USER": "_unused_",
"EMAIL_PASSWORD": "_unused_",
"IGNORE_CONFIG_FILE": "true",
"EMAIL_HOST": "smtp.gmail.com"
"EMAIL_HOST": "smtp.gmail.com",
"EMAIL_PORT": "587"
},
"keywords": [
"gavel",
Expand Down
21 changes: 13 additions & 8 deletions gavel/controllers/admin.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
from celery.utils.serialization import jsonify

from gavel import app
from gavel.models import *
from gavel.schemas.annotator import AnnotatorSchema
from gavel.schemas.decision import DecisionSchema
from gavel.schemas.flag import FlagSchema
from gavel.schemas.item import ItemSchema
from gavel.schemas.setting import SettingSchema
from gavel.constants import *
from functools import wraps
import gavel.settings as settings
import gavel.utils as utils
from flask import (
Expand All @@ -23,6 +17,17 @@
import urllib3
import xlrd

import asyncio

loop = asyncio.get_event_loop()

def async_action(f):
@wraps(f)
def wrapped(*args, **kwargs):
return loop.run_until_complete(f(*args, **kwargs))
return wrapped


ALLOWED_EXTENSIONS = {'csv', 'xlsx', 'xls'}


Expand Down Expand Up @@ -549,7 +554,7 @@ def annotator_detail(annotator_id):
def annotator_link(annotator):
return urllib.parse.urljoin(settings.BASE_URL, url_for('login', secret=annotator.secret))


@async_action
async def email_invite_links(annotators):
if settings.DISABLE_EMAIL or annotators is None:
return
Expand Down

0 comments on commit 48fc6c6

Please sign in to comment.