[Python-checkins] CVS: python/dist/src/Tools/faqwiz faqwiz.py,1.25,1.26

Guido van Rossum python-dev@python.org
Thu, 30 Mar 2000 19:58:03 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Tools/faqwiz
In directory eric:/projects/python/develop/guido/src/Tools/faqwiz

Modified Files:
	faqwiz.py 
Log Message:
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


Index: faqwiz.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Tools/faqwiz/faqwiz.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** faqwiz.py	1998/12/23 21:33:09	1.25
--- faqwiz.py	2000/03/31 00:58:00	1.26
***************
*** 113,116 ****
--- 113,123 ----
      return major, minor
  
+ logon = 0
+ def log(text):
+     if logon:
+         logfile = open("logfile", "a")
+         logfile.write(text + "\n")
+         logfile.close()
+ 
  def load_cookies():
      if not os.environ.has_key('HTTP_COOKIE'):
***************
*** 178,181 ****
--- 185,189 ----
      def __init__(self):
          self.__form = cgi.FieldStorage()
+         #log("\n\nbody: " + self.body)
  
      def __getattr__(self, name):
***************
*** 777,781 ****
              self.error("You didn't make any changes!")
              return
!         # XXX Should lock here
          try:
              os.unlink(file)
--- 785,794 ----
              self.error("You didn't make any changes!")
              return
! 
!         # 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:
              os.unlink(file)
***************
*** 799,811 ****
          emit(LOGHEADER, self.ui, os.environ, date=date, _file=f)
          f.close()
- 
-         command = interpolate(
-             SH_LOCK + '\n' + SH_CHECKIN,
-             file=file, tfn=tfn)
  
          p = os.popen(command)
          output = p.read()
          sts = p.close()
!         # XXX Should unlock here
          if not sts:
              self.prologue(T_COMMITTED)
--- 812,825 ----
          emit(LOGHEADER, self.ui, os.environ, date=date, _file=f)
          f.close()
  
+         command = interpolate(SH_CHECKIN, file=file, tfn=tfn)
+         log("\n\n" + command)
          p = os.popen(command)
          output = p.read()
          sts = p.close()
!         log("output: " + output)
!         log("done: " + str(sts))
!         log("TempFile:\n" + open(tfn).read() + "end")
!         
          if not sts:
              self.prologue(T_COMMITTED)