icp/oer/exercise-formats/program/old/match-regex-multifile/ExerciseHandler.py

33 lines
679 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import json
print("Handler program/match-regex loaded!")
# helper
class ExerciseHandler(object):
def __init__(self, parser=None):
self.parser = parser
self.data = {'code': ''}
print("ExerciseHandler program/match-regex")
print("parser.path", parser.path)
item = self.parser.item
data = self.data
# enable grading for this exercise type
item.grading = True
item.content = self.parser.get_exercise_content()
data['code'] = self.parser.get_file_content('program.c')
item.data = json.dumps(self.data)
item.save()