quotes/update_count.py.corrupt
changeset 0 d9b71931f372
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/quotes/update_count.py.corrupt	Thu May 27 13:10:09 2010 +0200
     1.3 @@ -0,0 +1,31 @@
     1.4 +#!/usr/bin/python
     1.5 +
     1.6 +import sys
     1.7 +import subprocess
     1.8 +from subprocess import PIPE
     1.9 +
    1.10 +SCRIPT_FILE = "../script.js"
    1.11 +
    1.12 +if __name__ == "__main__":
    1.13 +   quote_num = int(subprocess.Popen("ls quote*.html | wc -l", shell=True, stdout=PIPE).communicate()[0]) 
    1.14 +   file = open(SCRIPT_FILE, "r")   
    1.15 +   s = []
    1.16 +   try:
    1.17 +      s = file.readlines()
    1.18 +   finally:
    1.19 +      file.close() 
    1.20 +   print s
    1.21 +   sys.exit()
    1.22 +   if len(s) > 0:
    1.23 +      file = open(SCRIPT_FILE, "w")
    1.24 +      try:
    1.25 +         for line in s:
    1.26 +            print line
    1.27 +            if "var QUOTE_NUMBER" in line:
    1.28 +               print "replacing:" + line
    1.29 +               line = "var QUOTE_NUMBER = %s" % str(quote_num)               
    1.30 +         file.write(s)
    1.31 +      finally:
    1.32 +         file.close()
    1.33 +   
    1.34 +