Automatically exported from code.google.com/p/planningalerts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
810 B

  1. #!/usr/bin/python
  2. list_of_sites_filename = "PublicAccessSites.csv"
  3. template_filename = "CGITemplate"
  4. python_location = "/usr/bin/python"
  5. import csv
  6. from os import chmod
  7. list_of_sites_file = open(list_of_sites_filename)
  8. csv_reader = csv.DictReader(list_of_sites_file, quoting=csv.QUOTE_ALL, skipinitialspace=True)
  9. template_contents = open(template_filename).read()
  10. template = "#!" + python_location +"\n\n" + template_contents
  11. for site_dict in csv_reader:
  12. filename = "%s.cgi" %site_dict["authority_short_name"]
  13. contents = template %site_dict
  14. this_file = open(filename, "w")
  15. print "Writing %s" %filename
  16. this_file.write(contents)
  17. this_file.close()
  18. chmod(filename, 0755)
  19. # need to look at:
  20. # "Perth and Kinross Council", "Perthshire", "http://193.63.61.22/publicaccess/"