Commit 525915ba authored by Vladimir Mencl's avatar Vladimir Mencl

parse_institution_xml: pass write between methods

Recent changes to parse_intitution_xml (b0d86558) make log output go via write reference, conditional on verbosity settings.  However, this reference is defined in the handle method, but used in the parse_and_create method.

This breaks the parse_institution_xml script, failing with:

  File "/djnro/edumanage/management/commands/parse_institution_xml.py", line 70, in parse_and_create
      write('Created inst %s\n' % institution_obj.pk)
  NameError: global name 'write' is not defined

Fix this by explictly passing write from handle() to parse_and_create() as an additional argument.
parent 53a92424
......@@ -44,9 +44,9 @@ class Command(BaseCommand):
else:
write = lambda *args: None
self.parse_and_create(args[0])
self.parse_and_create(args[0], write)
def parse_and_create(self, instxmlfile):
def parse_and_create(self, instxmlfile, write):
doc = ElementTree.parse(instxmlfile)
realmid = Realm.objects.get(pk=1)
root = doc.getroot()
......
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