Package: python-libgmail
Version: 0.1.9-2
Severity: normal
Tags: patch

libgmail crashes when trying to parse a thread that contains a google
chat log (from using 'Reply by chat' or similiar options). The problem
is extracting attachments - the pseudo mail message created by google
chat leaves this blank, which causes the attempt to iterate over the
list to fail.

While I haven't tested libgmail 0.1.10, it doesn't look like the
relevant code has changed between the versions, so I suspect the same
problem will occur there.

The following patch fixes the problem for me.

--- libgmail.py 2008-10-16 18:53:20.000000000 +0200
+++ libgmail_modified.py        2008-10-16 18:52:52.000000000 +0200
@@ -1448,8 +1448,14 @@
         self.bcc = msgData[MI_BCC]
         self.sender = msgData[MI_AUTHOREMAIL]
         
-        self.attachments = [GmailAttachment(self, attachmentInfo)
-                            for attachmentInfo in msgData[MI_ATTACHINFO]]
+        # Messages created by google chat (from reply with chat, etc.)
+        # don't have any attachments, so we need this check not to choke
+        # on them
+        try:
+            self.attachments = [GmailAttachment(self, attachmentInfo)
+                    for attachmentInfo in msgData[MI_ATTACHINFO]]
+        except TypeError:
+            self.attachments = []
 
         # TODO: Populate additional fields & cache...(?)
 


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_ZA.UTF-8, LC_CTYPE=en_ZA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python-libgmail depends on:
ii  python                        2.5.2-2    An interactive high-level object-o
ii  python-central                0.6.8      register and build utility for Pyt
ii  python-clientcookie           1.3.0-1.1  Python module for automating HTTP 

python-libgmail recommends no packages.

python-libgmail suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to