Automatically exported from code.google.com/p/planningalerts
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

generateCGIScripts.py 810 B

1234567891011121314151617181920212223242526272829
  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/"