[Python-checkins] CVS: python/dist/src/Lib zipfile.py,1.2,1.3

Fred L. Drake python-dev@python.org
Fri, 29 Sep 2000 13:45:00 -0700


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

Modified Files:
	zipfile.py 
Log Message:

Always use the same name for the exception defined in this module!
Error reported via email by Pete Shinners <pete@visionart.com>.

Fixed some indentation inconsistencies.


Index: zipfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** zipfile.py	2000/06/13 18:49:53	1.2
--- zipfile.py	2000/09/29 20:44:48	1.3
***************
*** 11,17 ****
      zlib = None
  
! class _BadZipfile(Exception):
      pass
! error = _BadZipfile	# The exception raised by this module
  
  # constants for Zip file compression methods
--- 11,17 ----
      zlib = None
  
! class BadZipfile(Exception):
      pass
! error = BadZipfile	# The exception raised by this module
  
  # constants for Zip file compression methods
***************
*** 95,99 ****
              if not zlib:
                  raise RuntimeError,\
!                 "Compression requires the (missing) zlib module"
          else:
              raise RuntimeError, "That compression method is not supported"
--- 95,99 ----
              if not zlib:
                  raise RuntimeError,\
!                       "Compression requires the (missing) zlib module"
          else:
              raise RuntimeError, "That compression method is not supported"
***************
*** 181,186 ****
              if fname != data.filename:
                  raise RuntimeError, \
!  'File name in Central Directory "%s" and File Header "%s" differ.' % (
!                              data.filename, fname)
  
      def namelist(self):
--- 181,186 ----
              if fname != data.filename:
                  raise RuntimeError, \
!                       'File name in directory "%s" and header "%s" differ.' % (
!                           data.filename, fname)
  
      def namelist(self):
***************
*** 220,224 ****
          if not self.fp:
              raise RuntimeError, \
!             "Attempt to read ZIP archive that was already closed"
          zinfo = self.getinfo(name)
          filepos = self.fp.tell()
--- 220,224 ----
          if not self.fp:
              raise RuntimeError, \
!                   "Attempt to read ZIP archive that was already closed"
          zinfo = self.getinfo(name)
          filepos = self.fp.tell()
***************
*** 231,235 ****
              if not zlib:
                  raise RuntimeError, \
!                 "De-compression requires the (missing) zlib module"
              # zlib compress/decompress code by Jeremy Hylton of CNRI
              dc = zlib.decompressobj(-15)
--- 231,235 ----
              if not zlib:
                  raise RuntimeError, \
!                       "De-compression requires the (missing) zlib module"
              # zlib compress/decompress code by Jeremy Hylton of CNRI
              dc = zlib.decompressobj(-15)
***************
*** 241,245 ****
          else:
              raise BadZipfile, \
!             "Unsupported compression method %d for file %s" % \
              (zinfo.compress_type, name)
          crc = binascii.crc32(bytes)
--- 241,245 ----
          else:
              raise BadZipfile, \
!                   "Unsupported compression method %d for file %s" % \
              (zinfo.compress_type, name)
          crc = binascii.crc32(bytes)
***************
*** 257,267 ****
          if not self.fp:
              raise RuntimeError, \
!             "Attempt to write ZIP archive that was already closed"
          if zinfo.compress_type == ZIP_DEFLATED and not zlib:
              raise RuntimeError, \
!             "Compression requires the (missing) zlib module"
          if zinfo.compress_type not in (ZIP_STORED, ZIP_DEFLATED):
              raise RuntimeError, \
!             "That compression method is not supported"
  
      def write(self, filename, arcname=None, compress_type=None):
--- 257,267 ----
          if not self.fp:
              raise RuntimeError, \
!                   "Attempt to write ZIP archive that was already closed"
          if zinfo.compress_type == ZIP_DEFLATED and not zlib:
              raise RuntimeError, \
!                   "Compression requires the (missing) zlib module"
          if zinfo.compress_type not in (ZIP_STORED, ZIP_DEFLATED):
              raise RuntimeError, \
!                   "That compression method is not supported"
  
      def write(self, filename, arcname=None, compress_type=None):
***************
*** 438,442 ****
              if pathname[-3:] != ".py":
                  raise RuntimeError, \
!                 'Files added with writepy() must end with ".py"'
              fname, arcname = self._get_codename(pathname[0:-3], basename)
              if self.debug:
--- 438,442 ----
              if pathname[-3:] != ".py":
                  raise RuntimeError, \
!                       'Files added with writepy() must end with ".py"'
              fname, arcname = self._get_codename(pathname[0:-3], basename)
              if self.debug: