-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1998 from Sefaria/new-post
New post
- Loading branch information
Showing
15 changed files
with
286 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,12 @@ def jsonpResponse(data, callback, status=200): | |
return HttpResponse("%s(%s)" % (callback, json.dumps(data, ensure_ascii=False)), content_type="application/javascript; charset=utf-8", charset="utf-8", status=status) | ||
|
||
|
||
def celeryResponse(task_id: str, sub_task_ids: list[str] = None): | ||
data = {'task_id': task_id} | ||
if sub_task_ids: | ||
data['sub_task_ids'] = sub_task_ids | ||
return jsonResponse(data, status=202) | ||
|
||
def send_email(subject, message_html, from_email, to_email): | ||
msg = EmailMultiAlternatives(subject, message_html, "Sefaria <[email protected]>", [to_email], reply_to=[from_email]) | ||
msg.send() | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import requests | ||
from sefaria.settings import SLACK_URL | ||
|
||
|
||
def send_message(channel, username, pretext, text, fallback=None, icon_emoji=':robot_face:', color="#a30200"): | ||
post_object = { | ||
"icon_emoji": icon_emoji, | ||
"username": username, | ||
"channel": channel, | ||
"attachments": [ | ||
{ | ||
"fallback": fallback or pretext, | ||
"color": color, | ||
"pretext": pretext, | ||
"text": text | ||
} | ||
] | ||
} | ||
|
||
requests.post(SLACK_URL, json=post_object) |
Oops, something went wrong.