comparison 2.00/zipfile26.py @ 30:f17f19d9eb0a

hasattr -> try in the newly added 2.6 zipfile
author Oleg Oshmyan <chortos@inbox.lv>
date Wed, 24 Nov 2010 23:42:06 +0000
parents a8cc383b787c
children
comparison
equal deleted inserted replaced
29:a8cc383b787c 30:f17f19d9eb0a
623 self.rawbuffer = self.dc.unconsumed_tail if self.compress_type == ZIP_DEFLATED else '' 623 self.rawbuffer = self.dc.unconsumed_tail if self.compress_type == ZIP_DEFLATED else ''
624 if self.eof and len(self.rawbuffer) == 0: 624 if self.eof and len(self.rawbuffer) == 0:
625 # we're out of raw bytes (both from the file and 625 # we're out of raw bytes (both from the file and
626 # the local buffer); flush just to make sure the 626 # the local buffer); flush just to make sure the
627 # decompressor is done 627 # decompressor is done
628 if hasattr(self.dc, 'flush'): 628 try:
629 newdata += self.dc.flush() 629 newdata += self.dc.flush()
630 except AttributeError:
631 pass
630 # prevent decompressor from being used again 632 # prevent decompressor from being used again
631 self.dc = None 633 self.dc = None
632 634
633 self.readbuffer += newdata 635 self.readbuffer += newdata
634 636