#!/usr/bin/python
import cgi, os, os.path, time, re, xml.sax.saxutils, datetime
lockFileName = "files/todolock"
fileName = "files/todos.xml"
def getXMLDateString(date):
return "%d%d%d" % (date.year, date.month, date.day)
while(os.path.exists(lockFileName)):
time.sleep(.25)
lockFileHandle = open(lockFileName, "w")
lockFileHandle.write("locked")
lockFileHandle.close()
form = cgi.FieldStorage()
month = int(form.getfirst('month'))
year = int(form.getfirst('year'))
day = int(form.getfirst('day'))
numDays = form.getfirst('numDays')
startDate = datetime.date(year, month, day)
oldFile = open(fileName, 'r')
oldFileLines = oldFile.readlines()
oldFile.close()
print "Content-type: text/xml\n\n"
print ""
ticklerStartre = re.compile(r'')
ticklerEndre = re.compile(r'')
ticklerre = re.compile(r'"
print getXMLDateString(ticklerDate)
print "%s" % ticklerMatch.group(5)
print ""
if (ticklerStartre.match(line)):
inTicklers = True
elif (ticklerEndre.match(line)):
inTicklers = False
print ""
print "\n"
os.remove(lockFileName)