<s> from os . path import basename <EOL> from django . core . management . base import BaseCommand <EOL> from yaksh . models import Question , Quiz <EOL> def clear_exam ( ) : <EOL> """<STR_LIT>""" <EOL> for question in Question . objects . all ( ) : <EOL> question . active = False <EOL> question . save ( ) <EOL> for quiz in Quiz . objects . all ( ) : <EOL> quiz . active = False <EOL> quiz . save ( ) <EOL> def load_exam ( filename ) : <EOL> """<STR_LIT>""" <EOL> exec ( open ( filename ) . read ( ) ) <EOL> if '<STR_LIT>' not in locals ( ) : <EOL> msg = '<STR_LIT>' <EOL> raise NameError ( msg ) <EOL> for question in questions : <EOL> question [ <NUM_LIT:0> ] . save ( ) <EOL> for tag in question [ <NUM_LIT:1> ] : <EOL> question [ <NUM_LIT:0> ] . tags . add ( tag ) <EOL> if '<STR_LIT>' in locals ( ) : <EOL> quiz . save ( ) <EOL> class Command ( BaseCommand ) : <EOL> args = '<STR_LIT>' <EOL> help = '''<STR_LIT>''' <EOL> def handle ( self , * args , ** options ) : <EOL> """<STR_LIT>""" <EOL> clear_exam ( ) <EOL> for fname in args : <EOL> self . stdout . write ( '<STR_LIT>' . format ( basename ( fname ) ) ) <EOL> load_exam ( fname ) <EOL> self . stdout . write ( '<STR_LIT>' ) </s>
