jschaf/ideone-api — Issue #2: java incorrectly interpreted as javascript
Author: jschaf
Created: 2012-02-21 11:14:37+00:00
State: open

When you pass a language_name into create_submission it is translated to the integer, language_id which it what the Ideone API requires. The language list from Ideone specifies the version number of every language, e.g. "python 2.7".

To make the API easy to use, I wanted people to be able to pass "java" or "python" and have it correctly translated to the language_id.

I used prefix matching in ``_translate_language_name`` to ignore the version numbers. The offending code is below:

# Find it by comparing prefixes because the languages
# include version information
if v.lower().startswith(language_name.lower()):
language_id = k

This fails for 'java' because it matches 'javascript'.