old_contents: from __future__ import unicode_literals
  
  import os
  
  from . import helper
  
  
  
  def readStatus(student):
      student = student.lower()
  
      path = helper.getConfigValue("settings", "attachment_path")
  
      if not os.path.exists(path):
          return
  
      path = os.path.join(path, student)
  
      if not os.path.exists(path):
          return "Student ohne Abgabe"
  
      path = os.path.join(path, "korrekturstatus.txt")
  
      if not os.path.exists(path):
          return "Unbearbeitet"
      statusfile = open(path, "r")
      status = statusfile.read()
      statusfile.close()
      return status
  
  
  def writeStatus(student, status):
      student = student.lower()
      status = status.lower()
  
      path = os.path.join(helper.getConfigValue("settings", "attachment_path"), student)
  
      if not os.path.exists(path):
          logging.error("Requested student '%s' hasn't submitted anything yet.")
          return
  
      path = os.path.join(path, "korrekturstatus.txt")
      
      statusfile = open(path, "w")
      statusfile.write(status)
      statusfile.close()
  
new_contents: from __future__ import unicode_literals
  
  import os
  
  from . import helper
  
  
  def readStatus(student):
      student = student.lower()
  
      path = helper.getConfigValue("settings", "attachment_path")
  
      if not os.path.exists(path):
          return
  
      path = os.path.join(path, student)
  
      if not os.path.exists(path):
          return "Student ohne Abgabe"
  
      path = os.path.join(path, "korrekturstatus.txt")
  
      if not os.path.exists(path):
          return "Unbearbeitet"
  
      statusfile = open(path, "r")
      status = statusfile.read()
      statusfile.close()
      return status
  
  
  def writeStatus(student, status):
      student = student.lower()
      status = status.lower()
  
      path = os.path.join(helper.getConfigValue("settings", "attachment_path"), student)
  
      if not os.path.exists(path):
          logging.error("Requested student '%s' hasn't submitted anything yet.")
          return
  
      path = os.path.join(path, "korrekturstatus.txt")
  
      with open(path, "w") as statusfile:
          statusfile.write(status)
  
subject: Use open with