[Python-checkins] CVS: python/dist/src/Doc/lib libmath.tex,1.19,1.20

Guido van Rossum python-dev@python.org
Thu, 11 May 2000 14:42:29 -0400 (EDT)


Update of /projects/cvsroot/python/dist/src/Doc/lib
In directory eric:/projects/python/develop/guido/src/Doc/lib

Modified Files:
	libmath.tex 
Log Message:
The addition of rint() (by Peter Schneider-Kamp; I forgot to mention
that before) in the previous patch has one problem; rint() is not in
the C math library on all platforms (e.g. not for VC++).  Make it
conditional on HAVE_RINT.


Index: libmath.tex
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libmath.tex,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** libmath.tex	2000/05/11 18:19:40	1.19
--- libmath.tex	2000/05/11 18:42:27	1.20
***************
*** 96,99 ****
--- 96,100 ----
  \begin{funcdesc}{rint}{x, y}
  Return the integer nearest to \var{x} as a real.
+ (Only available on platforms where this is in the standard C math library.)
  \end{funcdesc}
  



Return-Path: <gvanrossum@slayer.i.sourceforge.net>
Delivered-To: python-checkins@python.org
Received: from slayer.i.sourceforge.net (sourceforge.net [198.186.203.33])
	by dinsdale.python.org (Postfix) with ESMTP id A902A1CDB3
	for <python-checkins@python.org>; Sun, 21 May 2000 12:25:29 -0400 (EDT)
Received: (from gvanrossum@localhost)
	by slayer.i.sourceforge.net (8.9.3/8.9.3) id JAA22258
	for python-checkins@python.org; Sun, 21 May 2000 09:25:32 -0700
Date: Sun, 21 May 2000 09:25:32 -0700
From: Guido van Rossum <gvanrossum@slayer.i.sourceforge.net>
Message-Id: <200005211625.JAA22258@slayer.i.sourceforge.net>
To: python-checkins@python.org
Subject: [Python-checkins] CVS: python/dist/src/Lib SimpleHTTPServer.py,1.9,1.10
Sender: python-checkins-admin@python.org
Errors-To: python-checkins-admin@python.org
X-BeenThere: python-checkins@python.org
X-Mailman-Version: 2.0beta3
Precedence: bulk
Reply-To: python-dev@python.org
List-Id: Check-in messages from the Python maintainers <python-checkins.python.org>

Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv22235

Modified Files:
	SimpleHTTPServer.py 
Log Message:
Changed list_directory() somewhat.  It is now only called when there
is no index.htm[l] file, and when it is called, it also spits out the
headers.  When an index.htm[l] file is present, the regular (file
access) path is followed.  Also, when the guessed content-type matches
text/*, open the file in text mode; otherwise in binary mode.


Index: SimpleHTTPServer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/SimpleHTTPServer.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** SimpleHTTPServer.py	2000/05/09 14:57:09	1.9
--- SimpleHTTPServer.py	2000/05/21 16:25:29	1.10
***************
*** 60,75 ****
          """
          path = self.translate_path(self.path)
          if os.path.isdir(path):
!             f = self.list_directory(path)
!             if f is None:
!                 return None
!             ctype = "text/HTML"
          else:
!             try:
!                 f = open(path, 'rb')
!             except IOError:
!                 self.send_error(404, "File not found")
!                 return None
!             ctype = self.guess_type(path)
          self.send_response(200)
          self.send_header("Content-type", ctype)
--- 60,82 ----
          """
          path = self.translate_path(self.path)
+         f = None
          if os.path.isdir(path):
!             for index in "index.html", "index.htm":
!                 index = os.path.join(path, index)
!                 if os.path.exists(index):
!                     path = index
!                     break
!             else:
!                 return self.list_directory(path)
!         ctype = self.guess_type(path)
!         if ctype.startswith('text/'):
!             mode = 'r'
          else:
!             mode = 'rb'
!         try:
!             f = open(path, mode)
!         except IOError:
!             self.send_error(404, "File not found")
!             return None
          self.send_response(200)
          self.send_header("Content-type", ctype)
***************
*** 78,81 ****
--- 85,95 ----
  
      def list_directory(self, path):
+         """Helper to produce a directory listing (absent index.html).
+ 
+         Return value is either a file object, or None (indicating an
+         error).  In either case, the headers are sent, making the
+         interface the same as for send_head().
+ 
+         """
          try:
              list = os.listdir(path)
***************
*** 89,101 ****
          for name in list:
              fullname = os.path.join(path, name)
!             displayname = name = cgi.escape(name)
              if os.path.islink(fullname):
                  displayname = name + "@"
!             elif os.path.isdir(fullname):
!                 displayname = name + "/"
!                 name = name + os.sep
!             f.write('<li><a href="%s">%s</a>\n' % (name, displayname))
          f.write("</ul>\n<hr>\n")
          f.seek(0)
          return f
  
--- 103,120 ----
          for name in list:
              fullname = os.path.join(path, name)
!             displayname = linkname = name = cgi.escape(name)
!             # Append / for directories or @ for symbolic links
!             if os.path.isdir(fullname):
!                 displayname = name + "/"
!                 linkname = name + os.sep
              if os.path.islink(fullname):
                  displayname = name + "@"
!                 # Note: a link to a directory displays with @ and links with /
!             f.write('<li><a href="%s">%s</a>\n' % (linkname, displayname))
          f.write("</ul>\n<hr>\n")
          f.seek(0)
+         self.send_response(200)
+         self.send_header("Content-type", "text/html")
+         self.end_headers()
          return f