Commit 2b6004a0 authored by Guido van Rossum's avatar Guido van Rossum

New version 1.0.4. I'm sure someone mailed me these patches but I

can't remember who. :-)  Changes:

- Support for Windows NT (different locking behavior)
- Added a logging mechanism
parent 8daef379
...@@ -112,6 +112,13 @@ def revparse(rev): ...@@ -112,6 +112,13 @@ def revparse(rev):
[major, minor] = map(string.atoi, m.group(1, 2)) [major, minor] = map(string.atoi, m.group(1, 2))
return major, minor return major, minor
logon = 0
def log(text):
if logon:
logfile = open("logfile", "a")
logfile.write(text + "\n")
logfile.close()
def load_cookies(): def load_cookies():
if not os.environ.has_key('HTTP_COOKIE'): if not os.environ.has_key('HTTP_COOKIE'):
return {} return {}
...@@ -177,6 +184,7 @@ class UserInput: ...@@ -177,6 +184,7 @@ class UserInput:
def __init__(self): def __init__(self):
self.__form = cgi.FieldStorage() self.__form = cgi.FieldStorage()
#log("\n\nbody: " + self.body)
def __getattr__(self, name): def __getattr__(self, name):
if name[0] == '_': if name[0] == '_':
...@@ -776,7 +784,12 @@ class FaqWizard: ...@@ -776,7 +784,12 @@ class FaqWizard:
if self.ui.body == entry.body and self.ui.title == entry.title: if self.ui.body == entry.body and self.ui.title == entry.title:
self.error("You didn't make any changes!") self.error("You didn't make any changes!")
return return
# XXX Should lock here
# need to lock here because otherwise the file exists and is not writable (on NT)
command = interpolate(SH_LOCK, file=file)
p = os.popen(command)
output = p.read()
try: try:
os.unlink(file) os.unlink(file)
except os.error: except os.error:
...@@ -799,14 +812,15 @@ class FaqWizard: ...@@ -799,14 +812,15 @@ class FaqWizard:
emit(LOGHEADER, self.ui, os.environ, date=date, _file=f) emit(LOGHEADER, self.ui, os.environ, date=date, _file=f)
f.close() f.close()
command = interpolate( command = interpolate(SH_CHECKIN, file=file, tfn=tfn)
SH_LOCK + '\n' + SH_CHECKIN, log("\n\n" + command)
file=file, tfn=tfn)
p = os.popen(command) p = os.popen(command)
output = p.read() output = p.read()
sts = p.close() sts = p.close()
# XXX Should unlock here log("output: " + output)
log("done: " + str(sts))
log("TempFile:\n" + open(tfn).read() + "end")
if not sts: if not sts:
self.prologue(T_COMMITTED) self.prologue(T_COMMITTED)
emit(COMMITTED) emit(COMMITTED)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment