old_contents: #!/usr/bin/python
  
  import sys
  import os
  try:
      import json
  except:
      from django.utils import simplejson as json
  sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)))
  sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)))
  import manage
  os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.base'
  
  from django.test.client import Client
  from settings import DHCP_CONFIG_OUTPUT_DIRECTORY
  def main():
      client = Client()
      dhcp_scopes = []
      dhcp_scopes = json.loads(client.get('/api/dhcp/1/get_scopes/', follow=True).content)
      output_dir = DHCP_CONFIG_OUTPUT_DIRECTORY
      for dhcp_scope in dhcp_scopes:
          dir = dhcp_scope.split("-")[0]
          output_file = dhcp_scope.split("-")[1]
          final_destination_file = "%s/%s/%s_generated_hosts.conf" % (output_dir,dir, output_file)
          output_text = client.get('/api/dhcp/%s/view_hosts/' % dhcp_scope).content
          output_text = output_text[1:-1]
          f = open(final_destination_file,"w")
          output_text =  output_text.replace("\\n","\n")
          output_text =  output_text.replace('\\"','"')
          #print output_text
          f.write(output_text)
          f.close()
      if len(dhcp_scopes) > 0:
          os.chdir(output_dir)
          os.system('/usr/bin/svn update')
          os.system('/usr/bin/svn add * --force')
          os.system('/usr/bin/svn commit -m "Autogenerated addition from inventory"')
      #os.system('/usr/bin/git push origin master')
  
  
  if __name__ == '__main__':
      main()
  
new_contents: #!/usr/bin/python
  
  import sys
  import os
  try:
      import json
  except:
      from django.utils import simplejson as json
  sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)))
  sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)))
  import manage
  os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.base'
  
  from django.test.client import Client
  from settings import DHCP_CONFIG_OUTPUT_DIRECTORY
  def main():
      client = Client()
      dhcp_scopes = []
      dhcp_scopes = json.loads(client.get('/api/dhcp/1/get_scopes/', follow=True).content)
      output_dir = DHCP_CONFIG_OUTPUT_DIRECTORY
      for dhcp_scope in dhcp_scopes:
          dir = dhcp_scope.split("-")[0]
          output_file = dhcp_scope.split("-")[1]
          final_destination_file = "%s/%s/%s_generated_hosts.conf" % (output_dir,dir, output_file)
          output_text = client.get('/api/dhcp/%s/view_hosts/' % dhcp_scope, follow=True).content
          output_text = output_text[1:-1]
          f = open(final_destination_file,"w")
          output_text =  output_text.replace("\\n","\n")
          output_text =  output_text.replace('\\"','"')
          #print output_text
          f.write(output_text)
          f.close()
      if len(dhcp_scopes) > 0:
          os.chdir(output_dir)
          os.system('/usr/bin/svn update')
          os.system('/usr/bin/svn add * --force')
          os.system('/usr/bin/svn commit -m "Autogenerated addition from inventory"')
      #os.system('/usr/bin/git push origin master')
  
  
  if __name__ == '__main__':
      main()
  
subject: Fix for dhcp