Группа :: Сети/Почта
Пакет: python-module-pyzor
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: pyzor-0.4.0-mdk-handle_unknown_encoding.patch
--- lib/pyzor/client.py 2002-09-08 22:37:15.000000000 +0200
+++ /home/calvin/debian/pyzor-0.4.0/lib/pyzor/client.py 2002-12-29 00:23:31.000000000 +0100
@@ -664,13 +668,20 @@
if self.type == 'text':
encoding = msg.getencoding()
- if encoding == '7bit':
- self.curfile = msg.fp
- else:
- self.curfile = tempfile.TemporaryFile()
- mimetools.decode(msg.fp, self.curfile, encoding)
- self.curfile.seek(0)
-
+ self.curfile = msg.fp
+ if encoding != '7bit':
+ # fix bad encoding name
+ if encoding == '8bits':
+ encoding = '8bit'
+ try:
+ newcurfile = tempfile.TemporaryFile()
+ mimetools.decode(msg.fp, newcurfile, encoding)
+ newcurfile.seek(0)
+ self.curfile = newcurfile
+ except ValueError:
+ # ignore encoding on errors, pass msg as is
+ pass
+
elif self.type == 'multipart':
import multifile
self.multifile = multifile.MultiFile(msg.fp, seekable=False)