Skip to content

Commit

Permalink
No parse on save (#496)
Browse files Browse the repository at this point in the history
* Do not parse program on saving.
  • Loading branch information
fpereiro authored Jun 15, 2021
1 parent 20fbf2c commit fd0efcb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
12 changes: 0 additions & 12 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,17 +735,6 @@ def save_program (user):
if not object_check (body, 'adventure_name', 'str'):
return 'if present, adventure_name must be a string', 400

# We execute the saved program to see if it would generate an error or not
error = None
try:
hedy_errors = TRANSLATIONS.get_translations(requested_lang(), 'HedyErrorMessages')
result = hedy.transpile(body ['code'], body ['level'])
except hedy.HedyException as E:
error_template = hedy_errors[E.error_code]
error = error_template.format(**E.arguments)
except Exception as E:
error = str(E)

name = body ['name']

# If name ends with (N) or (NN), we strip them since it's very likely these addenda were added by our server to avoid overwriting existing programs.
Expand All @@ -770,7 +759,6 @@ def save_program (user):
'level': body ['level'],
'code': body ['code'],
'name': name,
'server_error': error,
'username': user ['username']
}

Expand Down
1 change: 0 additions & 1 deletion doc/backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ table programs:
level: INTEGER
lang: STRING
code: STRING
server_error: STRING
version: STRING
```

Expand Down

0 comments on commit fd0efcb

Please sign in to comment.