Mercurial > ~astiob > upreckon > hgweb
comparison 2.00/zipfile3.py @ 28:3d535503161f
hasattr -> try
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Wed, 24 Nov 2010 01:42:39 +0000 |
parents | ec6f1a132109 |
children |
comparison
equal
deleted
inserted
replaced
27:dc4be35d17e0 | 28:3d535503161f |
---|---|
632 self.rawbuffer = self.dc.unconsumed_tail if self.compress_type == ZIP_DEFLATED else '' | 632 self.rawbuffer = self.dc.unconsumed_tail if self.compress_type == ZIP_DEFLATED else '' |
633 if self.eof and len(self.rawbuffer) == 0: | 633 if self.eof and len(self.rawbuffer) == 0: |
634 # we're out of raw bytes (both from the file and | 634 # we're out of raw bytes (both from the file and |
635 # the local buffer); flush just to make sure the | 635 # the local buffer); flush just to make sure the |
636 # decompressor is done | 636 # decompressor is done |
637 if hasattr(self.dc, 'flush'): | 637 try: |
638 newdata += self.dc.flush() | 638 newdata += self.dc.flush() |
639 except AttributeError: | |
640 pass | |
639 # prevent decompressor from being used again | 641 # prevent decompressor from being used again |
640 self.dc = None | 642 self.dc = None |
641 | 643 |
642 self.readbuffer += newdata | 644 self.readbuffer += newdata |
643 | 645 |