Commit eeaa1e04 by kimth

Capa util function to turn File objects in dict to filename (string)

parent 7a9489a9
...@@ -30,3 +30,14 @@ def contextualize_text(text, context): # private ...@@ -30,3 +30,14 @@ def contextualize_text(text, context): # private
for key in sorted(context, lambda x, y: cmp(len(y), len(x))): for key in sorted(context, lambda x, y: cmp(len(y), len(x))):
text = text.replace('$' + key, str(context[key])) text = text.replace('$' + key, str(context[key]))
return text return text
def convert_files_to_filenames(answers):
'''
Check for File objects in the dict of submitted answers,
convert File objects to their filename (string)
'''
new_answers = dict()
for answer_id in answers.keys():
new_answers[answer_id] = str(answers[answer_id])
return new_answers
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment