-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into failing-tests
- Loading branch information
Showing
42 changed files
with
1,624 additions
and
425 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
name: Continuous | ||
on: | ||
push: | ||
branches: | ||
- "*" | ||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
|
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 |
---|---|---|
|
@@ -1215,7 +1215,6 @@ def edit_text(request, ref=None, lang=None, version=None): | |
mode = "Add" | ||
else: | ||
# Pull a particular section to edit | ||
version = version.replace("_", " ") if version else None | ||
#text = get_text(ref, lang=lang, version=version) | ||
text = TextFamily(Ref(ref), lang=lang, version=version).contents() | ||
text["mode"] = request.path.split("/")[1] | ||
|
@@ -1389,15 +1388,11 @@ def texts_api(request, tref): | |
commentary = bool(int(request.GET.get("commentary", False))) | ||
pad = bool(int(request.GET.get("pad", 1))) | ||
versionEn = request.GET.get("ven", None) | ||
versionHe = request.GET.get("vhe", None) | ||
firstAvailableRef = bool(int(request.GET.get("firstAvailableRef", False))) # use first available ref, which may not be the same as oref | ||
if firstAvailableRef: | ||
temp_oref = oref.first_available_section_ref() | ||
oref = temp_oref or oref # don't overwrite oref if first available section ref fails | ||
if versionEn: | ||
versionEn = versionEn.replace("_", " ") | ||
versionHe = request.GET.get("vhe", None) | ||
if versionHe: | ||
versionHe = versionHe.replace("_", " ") | ||
layer_name = request.GET.get("layer", None) | ||
alts = bool(int(request.GET.get("alts", True))) | ||
wrapLinks = bool(int(request.GET.get("wrapLinks", False))) | ||
|
@@ -1553,9 +1548,6 @@ def social_image_api(request, tref): | |
ref = Ref(tref) | ||
ref_str = ref.normal() if lang == "en" else ref.he_normal() | ||
|
||
if version: | ||
version = version.replace("_", " ") | ||
|
||
tf = TextFamily(ref, stripItags=True, lang=lang, version=version, context=0, commentary=False).contents() | ||
|
||
he = tf["he"] if type(tf["he"]) is list else [tf["he"]] | ||
|
@@ -3103,14 +3095,14 @@ def add_new_topic_api(request): | |
data = json.loads(request.POST["json"]) | ||
isTopLevelDisplay = data["category"] == Topic.ROOT | ||
t = Topic({'slug': "", "isTopLevelDisplay": isTopLevelDisplay, "data_source": "sefaria", "numSources": 0}) | ||
update_topic_titles(t, data) | ||
update_topic_titles(t, **data) | ||
|
||
if not isTopLevelDisplay: # not Top Level so create an IntraTopicLink to category | ||
new_link = IntraTopicLink({"toTopic": data["category"], "fromTopic": t.slug, "linkType": "displays-under", "dataSource": "sefaria"}) | ||
new_link.save() | ||
|
||
if data["category"] == 'authors': | ||
t = update_authors_place_and_time(t, data) | ||
t = update_authors_place_and_time(t, **data) | ||
|
||
t.description_published = True | ||
t.data_source = "sefaria" # any topic edited manually should display automatically in the TOC and this flag ensures this | ||
|
@@ -3165,15 +3157,15 @@ def topics_api(request, topic, v2=False): | |
if not request.user.is_staff: | ||
return jsonResponse({"error": "Adding topics is locked.<br><br>Please email [email protected] if you believe edits are needed."}) | ||
topic_data = json.loads(request.POST["json"]) | ||
topic_obj = Topic().load({'slug': topic_data["origSlug"]}) | ||
topic = Topic().load({'slug': topic_data["origSlug"]}) | ||
topic_data["manual"] = True | ||
author_status_changed = (topic_data["category"] == "authors") ^ (topic_data["origCategory"] == "authors") | ||
topic_obj = update_topic(topic_obj, **topic_data) | ||
topic = update_topic(topic, **topic_data) | ||
if author_status_changed: | ||
library.build_topic_auto_completer() | ||
|
||
def protected_index_post(request): | ||
return jsonResponse(topic_obj.contents()) | ||
return jsonResponse(topic.contents()) | ||
return protected_index_post(request) | ||
|
||
|
||
|
@@ -3293,6 +3285,16 @@ def recommend_topics_api(request, ref_list=None): | |
return response | ||
|
||
|
||
@api_view(["GET"]) | ||
@catch_error_as_json | ||
def portals_api(request, slug): | ||
""" | ||
API to get data for a Portal object by slug | ||
""" | ||
portal = Portal.init(slug) | ||
return jsonResponse(portal.contents(), callback=request.GET.get("callback", None)) | ||
|
||
|
||
@ensure_csrf_cookie | ||
@sanitize_get_params | ||
def global_activity(request, page=1): | ||
|
@@ -4012,8 +4014,17 @@ def random_text_api(request): | |
""" | ||
Return Texts API data for a random ref. | ||
""" | ||
categories = set(request.GET.get('categories', '').split('|')) | ||
titles = set(request.GET.get('titles', '').split('|')) | ||
|
||
if "categories" in request.GET: | ||
categories = set(request.GET.get('categories', '').split('|')) | ||
else: | ||
categories = None | ||
|
||
if "titles" in request.GET: | ||
titles = set(request.GET.get('titles', '').split('|')) | ||
else: | ||
titles = None | ||
|
||
response = redirect(iri_to_uri("/api/texts/" + random_ref(categories, titles)) + "?commentary=0&context=0", permanent=False) | ||
return response | ||
|
||
|
@@ -4565,4 +4576,3 @@ def isNodeJsReachable(): | |
logger.warn("Failed rollout healthcheck. Healthcheck Response: {}".format(resp)) | ||
|
||
return http.JsonResponse(resp, status=statusCode) | ||
|
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import django | ||
|
||
django.setup() | ||
|
||
from sefaria.helper.topic import add_image_to_topic | ||
|
||
## Adding images | ||
|
||
hardcodedTopicImagesMap = { | ||
'rosh-hashanah': {'image_uri': 'https://storage.googleapis.com/img.sefaria.org/topics/rosh-hashanah.jpeg', | ||
'enCaption': 'Rosh Hashanah, Arthur Szyk (1894-1951) Tempera and ink on paper. New Canaan, 1948. Collection of Yeshiva University Museum. Gift of Charles Frost', | ||
'heCaption': 'ראש השנה, ארתור שיק, ארה״ב 1948. אוסף ישיבה יוניברסיטי'}, | ||
|
||
'yom-kippur': {'image_uri': 'https://storage.googleapis.com/img.sefaria.org/topics/yom-kippur.jpeg', | ||
'enCaption': 'Micrography of Jonah being swallowed by the fish. Germany, 1300-1500, The British Library', | ||
'heCaption': 'מיקרוגרפיה של יונה בבטן הדג, מתוך ספר יונה ההפטרה של יום כיפור, 1300-1500'}, | ||
|
||
'the-four-species': {'image_uri': 'https://storage.googleapis.com/img.sefaria.org/topics/the-four-species.jpg', | ||
'enCaption': 'Etrog container, K B, late 19th century, Germany. The Jewish Museum, Gift of Dr. Harry G. Friedman', | ||
'heCaption': 'תיבת אתרוג, סוף המאה ה19, גרמניה. המוזיאון היהודי בניו יורק, מתנת דר. הארי ג. פרידמן '}, | ||
|
||
'sukkot': {'image_uri': 'https://storage.googleapis.com/img.sefaria.org/topics/sukkot.jpg', | ||
'enCaption': 'Detail of a painting of a sukkah. Image taken from f. 316v of Forli Siddur. 1383, Italian rite. The British Library', | ||
'heCaption': 'פרט ציור של סוכה עם שולחן פרוש ושלוש דמויות. דימוי מתוך סידור פורלי, 1383 איטליה'}, | ||
|
||
'simchat-torah': {'image_uri': 'https://storage.googleapis.com/img.sefaria.org/topics/simchat-torah.jpg', | ||
'enCaption': 'Rosh Hashanah postcard: Hakafot, Haim Yisroel Goldberg (1888-1943) Publisher: Williamsburg Post Card Co. Germany, ca. 1915 Collection of Yeshiva University Museum', | ||
'heCaption': 'גלויה לראש השנה: הקפות, חיים גולדברג, גרמניה 1915, אוסף ישיבה יוניברסיטי'}, | ||
|
||
'shabbat': {'image_uri': 'https://storage.googleapis.com/img.sefaria.org/topics/shabbat.jpg', | ||
'enCaption': 'Friday Evening, Isidor Kaufmann, Austria c. 1920. The Jewish Museum, Gift of Mr. and Mrs. M. R. Schweitzer', | ||
'heCaption': 'שישי בערב, איזידור קאופמן, וינה 1920. המוזיאון היהודי בניו יורק, מתנת מר וגברת מ.ר. שוויצר'}, | ||
|
||
} | ||
|
||
for topic in hardcodedTopicImagesMap: | ||
add_image_to_topic(topic, | ||
image_uri=hardcodedTopicImagesMap[topic]["image_uri"], | ||
en_caption=hardcodedTopicImagesMap[topic]["enCaption"], | ||
he_caption=hardcodedTopicImagesMap[topic]["heCaption"]) |
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
Oops, something went wrong.