Skip to content

Commit

Permalink
fixes merge conflict in French transpile error
Browse files Browse the repository at this point in the history
  • Loading branch information
Felienne committed Feb 26, 2021
2 parents e6b1318 + e68acd7 commit 2b8df99
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 35 deletions.
8 changes: 6 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ def parse():

code = body ['code']
level = int(body ['level'])
# Language should come principally from the request body,
# but we'll fall back to browser default if it's missing for whatever
# reason.
lang = body.get('lang', requested_lang())

# For debugging
print(f"got code {code}")
Expand All @@ -108,7 +112,7 @@ def parse():
# is so, parse
else:
try:
hedy_errors = TRANSLATIONS.get_translations(requested_lang(), 'HedyErrorMessages')
hedy_errors = TRANSLATIONS.get_translations(lang, 'HedyErrorMessages')
result = hedy.transpile(code, level)
response["Code"] = "# coding=utf8\n" + result
except hedy.HedyException as E:
Expand All @@ -131,7 +135,7 @@ def parse():
'session': session_id(),
'date': str(datetime.datetime.now()),
'level': level,
'lang': requested_lang(),
'lang': lang,
'code': code,
'server_error': response.get('Error'),
'version': version(),
Expand Down
23 changes: 22 additions & 1 deletion auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from config import config
import boto3
from botocore.exceptions import ClientError as email_error
import json
import requests

cookie_name = config ['session'] ['cookie_name']
session_length = config ['session'] ['session_length'] * 60
Expand Down Expand Up @@ -145,7 +147,26 @@ def signup ():
email = body ['email'].strip ().lower ()

if env and 'subscribe' in body and body ['subscribe'] == True:
send_email (config ['email'] ['sender'], 'Subscription to Hedy newsletter on signup', email, '<p>' + email + '</p>')
# If we have a Mailchimp API key, we use it to add the subscriber through the API
if os.getenv ('MAILCHIMP_API_KEY') and os.getenv ('MAILCHIMP_AUDIENCE_ID'):
# The first domain in the path is the server name, which is contained in the Mailchimp API key
request_path = 'https://' + os.getenv ('MAILCHIMP_API_KEY').split ('-') [1] + '.api.mailchimp.com/3.0/lists/' + os.getenv ('MAILCHIMP_AUDIENCE_ID') + '/members'
request_headers = {'Content-Type': 'application/json', 'Authorization': 'apikey ' + os.getenv ('MAILCHIMP_API_KEY')}
request_body = {'email_address': email, 'status': 'subscribed'}
r = requests.post (request_path, headers=request_headers, data=json.dumps (request_body))

subscription_error = None
if r.status_code != 200 and r.status_code != 400:
subscription_error = True
# We can get a 400 if the email is already subscribed to the list. We should ignore this error.
if r.status_code == 400 and not re.match ('.*already a list member', r.text):
subscription_error = True
# If there's an error in subscription through the API, we report it to the main email address
if subscription_error:
send_email (config ['email'] ['sender'], 'ERROR - Subscription to Hedy newsletter on signup', email, '<p>' + email + '</p><pre>Status:' + str (r.status_code) + ' Body:' + r.text + '</pre>')
# Otherwise, we send an email to notify about this to the main email address
else:
send_email (config ['email'] ['sender'], 'Subscription to Hedy newsletter on signup', email, '<p>' + email + '</p>')

user = {
'username': username,
Expand Down
16 changes: 9 additions & 7 deletions main/press-en.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
page_title: Press — Hedy
---
# Hedy in the news
Since our release in early 2020, some people have written about us! We keep a list here:
Some websites and newspapers have written about Hedy since our release in early 2020. We keep a list here:

* [Ingeniería De Software (Spanish), February 2021](https://ingenieriadesoftware.es/hedy-mejor-lenguaje-ensenar-programacion-ninos/)
* [Hello World Magazine, February 2021](images/Hello_World_15_Hedy.pdf)
* [Felienne wins the Dutch award for ICT research for Hedy, January 2021](https://www.nwo.nl/en/news/felienne-hermans-receives-dutch-prize-ict-research-2021)
* [SlashDot, August 20th 2020](https://news.slashdot.org/story/20/08/17/024248/scientist-proposes-a-new-programming-language-for-teaching-coding-and-python)
* [GenBeta (Spanish), August 19th 2020](https://www.genbeta.com/desarrollo/nuevo-lenguaje-para-ensenar-programacion-a-ninos-como-se-ensena-a-leer-escribir-forma-gradual-niveles)
* [Developpez (French), August 18th 2020](https://programmation.developpez.com/actu/308095/Une-scientifique-propose-un-nouveau-langage-de-programmation-pour-enseigner-aux-enfants-le-codage-informatique-au-travers-d-une-approche-graduelle-implementee-en-Python-sur-13-paliers/)
* [SlashDot, August 2020](https://news.slashdot.org/story/20/08/17/024248/scientist-proposes-a-new-programming-language-for-teaching-coding-and-python)
* [GenBeta (Spanish), August 2020](https://www.genbeta.com/desarrollo/nuevo-lenguaje-para-ensenar-programacion-a-ninos-como-se-ensena-a-leer-escribir-forma-gradual-niveles)
* [Developpez (French), August 2020](https://programmation.developpez.com/actu/308095/Une-scientifique-propose-un-nouveau-langage-de-programmation-pour-enseigner-aux-enfants-le-codage-informatique-au-travers-d-une-approche-graduelle-implementee-en-Python-sur-13-paliers/)
* [Vives (Dutch), October 2020](images/artikel_vives.pdf) "Met Hedy stap voor stap leren programmeren"
* [Leiden University, April 25th 2020](https://www.universiteitleiden.nl/en/news/2020/03/looking-to-distract-the-kids-while-you-work-from-home-get-them-programming)
* [Mare (Dutch), April 10th 2020](https://www.mareonline.nl/cultuur/computercode-voor-de-kids/)
* [AG Connect (Dutch), April 3rd 2020](https://www.agconnect.nl/artikel/stapsgewijs-python-leren-programmeren-met-nieuwe-taal-hedy)
* [Leiden University, April 2020](https://www.universiteitleiden.nl/en/news/2020/03/looking-to-distract-the-kids-while-you-work-from-home-get-them-programming)
* [Mare (Dutch), April 2020](https://www.mareonline.nl/cultuur/computercode-voor-de-kids/)
* [AG Connect (Dutch), April 2020](https://www.agconnect.nl/artikel/stapsgewijs-python-leren-programmeren-met-nieuwe-taal-hedy)

29 changes: 10 additions & 19 deletions main/press-es.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,15 @@ page_title: Noticias — Hedy
---
# Hedy en la prensa

**Vives (Neerlandés), octubre de 2020**
* [Link](images/artikel_vives.pdf "Met Hedy stap voor stap leren programmeren")
* [Ingeniería De Software(Español), February 2021](https://ingenieriadesoftware.es/hedy-mejor-lenguaje-ensenar-programacion-ninos/)
* [Hello World Magazine (Inglés), February 2021](images/Hello_World_15_Hedy.pdf)
* [Felienne wins the Dutch award for ICT research for Hedy (Inglés), January 2021](https://www.nwo.nl/en/news/felienne-hermans-receives-dutch-prize-ict-research-2021)
* [SlashDot (Inglés), August 2020](https://news.slashdot.org/story/20/08/17/024248/scientist-proposes-a-new-programming-language-for-teaching-coding-and-python)
* [GenBeta (Español), August 2020](https://www.genbeta.com/desarrollo/nuevo-lenguaje-para-ensenar-programacion-a-ninos-como-se-ensena-a-leer-escribir-forma-gradual-niveles)
* [Developpez (Francés), August 2020](https://programmation.developpez.com/actu/308095/Une-scientifique-propose-un-nouveau-langage-de-programmation-pour-enseigner-aux-enfants-le-codage-informatique-au-travers-d-une-approche-graduelle-implementee-en-Python-sur-13-paliers/)
* [Vives (Neerlandés), October 2020](images/artikel_vives.pdf) "Met Hedy stap voor stap leren programmeren"
* [Universidad de Leiden (Inglés), April 2020](https://www.universiteitleiden.nl/en/news/2020/03/looking-to-distract-the-kids-while-you-work-from-home-get-them-programming)
* [Mare (Neerlandés), April 2020](https://www.mareonline.nl/cultuur/computercode-voor-de-kids/)
* [AG Connect (Neerlandés), April 2020](https://www.agconnect.nl/artikel/stapsgewijs-python-leren-programmeren-met-nieuwe-taal-hedy)

**SlashDot (Inglés), 20 de agosto de 2020**
* [Link](https://news.slashdot.org/story/20/08/17/024248/scientist-proposes-a-new-programming-language-for-teaching-coding-and-python)

**GenBeta (Español), 19 de agosto de 2020**
* [Link](https://www.genbeta.com/desarrollo/nuevo-lenguaje-para-ensenar-programacion-a-ninos-como-se-ensena-a-leer-escribir-forma-gradual-niveles)

**Developpez (Francés), 18 de agosto de 2020**
* [Link](https://programmation.developpez.com/actu/308095/Une-scientifique-propose-un-nouveau-langage-de-programmation-pour-enseigner-aux-enfants-le-codage-informatique-au-travers-d-une-approche-graduelle-implementee-en-Python-sur-13-paliers/)

**Universidad de Leiden (Inglés), 25 de april de 2020**
[![Header Uni](images/UniLeiden-EN.png "Header Uni")](https://www.universiteitleiden.nl/en/news/2020/03/looking-to-distract-the-kids-while-you-work-from-home-get-them-programming)

**Mare (Neerlandés), 10 de abril de 2020**
[![Header Mare](images/mare.png "Header Mare")](https://www.mareonline.nl/cultuur/computercode-voor-de-kids/)

**AG Connect (Neerlandés), 3 de abril de 2020**
[![Header AG Connect](images/agconnect.png "Header AG Connect")](https://www.agconnect.nl/artikel/stapsgewijs-python-leren-programmeren-met-nieuwe-taal-hedy)

12 changes: 7 additions & 5 deletions main/press-nl.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ page_title: Pers — Hedy
---
# Hedy in het nieuws

Soms schrijven mensen iets over Hedy, dat houden we op deze lijst bij:
Soms schrijven websites en kranten iets over Hedy, dat houden we op deze lijst bij:

* [Ingeniería De Software (Spaans), februari 2021](https://ingenieriadesoftware.es/hedy-mejor-lenguaje-ensenar-programacion-ninos/)
* [Hello World Magazine (Engels), februari 2021](images/Hello_World_15_Hedy.pdf)
* [AG Connect over prijs voor ICT onderzoek, januari 2021](http://www.agconnect.nl/artikel/stapsgewijs-python-leren-programmeren-met-nieuwe-taal-hedy)
* [Felienne wint de prijs voor ICT onderzoek voor Hedy, januari 2021](https://www.nwo.nl/en/news/felienne-hermans-receives-dutch-prize-ict-research-2021)
* [Outreach financiering, januari 2021](https://beta.vu.nl/nl/onderzoek/outreach-beta/index.aspx)
* [Felienne op de radio bij Sleutelstad FM](https://sleutelstad.nl/programma/science071/uitzending/2020-12-16/?uur=0&start=723)
* [Felienne op de radio bij Sleutelstad FM, december 2020](https://sleutelstad.nl/programma/science071/uitzending/2020-12-16/?uur=0&start=723)
* [Vives, oktober 2020](images/artikel_vives.pdf "Met Hedy stap voor stap leren programmeren")
* [SlashDot (Engels), 20 augustus 2020](https://news.slashdot.org/story/20/08/17/024248/scientist-proposes-a-new-programming-language-for-teaching-coding-and-python)
* [GenBeta (Spaans), 19 augustus 2020](https://www.genbeta.com/desarrollo/nuevo-lenguaje-para-ensenar-programacion-a-ninos-como-se-ensena-a-leer-escribir-forma-gradual-niveles)
* [Developpez (Frans), 18 augustus 2020](https://programmation.developpez.com/actu/308095/Une-scientifique-propose-un-nouveau-langage-de-programmation-pour-enseigner-aux-enfants-le-codage-informatique-au-travers-d-une-approche-graduelle-implementee-en-Python-sur-13-paliers/)
* [SlashDot (Engels), augustus 2020](https://news.slashdot.org/story/20/08/17/024248/scientist-proposes-a-new-programming-language-for-teaching-coding-and-python)
* [GenBeta (Spaans), augustus 2020](https://www.genbeta.com/desarrollo/nuevo-lenguaje-para-ensenar-programacion-a-ninos-como-se-ensena-a-leer-escribir-forma-gradual-niveles)
* [Developpez (Frans), augustus 2020](https://programmation.developpez.com/actu/308095/Une-scientifique-propose-un-nouveau-langage-de-programmation-pour-enseigner-aux-enfants-le-codage-informatique-au-travers-d-une-approche-graduelle-implementee-en-Python-sur-13-paliers/)
Binary file added static/images/Hello_World_15_Hedy.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion tests_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def request(test, counter):
if type_check (test[4], 'dict'):
test[3] ['content-type'] = 'application/json'
test[4] = json.dumps (test [4])
r = getattr (requests, test [1])(host + test [2], headers=test[3], data=test[4])
r = getattr (requests, test [1]) (host + test [2], headers=test[3], data=test[4])

if 'Content-Type' in r.headers and r.headers ['Content-Type'] == 'application/json':
body = r.json ()
Expand Down

0 comments on commit 2b8df99

Please sign in to comment.