do not send None as avatar mime tye

This commit is contained in:
Yann Leboulanger 2005-09-15 16:57:42 +00:00
parent 18c04d4323
commit 4d4434c951
1 changed files with 4 additions and 2 deletions

View File

@ -188,6 +188,7 @@ class VcardWindow:
image = self.xml.get_widget('PHOTO_image')
image.set_from_pixbuf(pixbuf)
self.avatar_encoded = base64.encodestring(data)
# returns None if unknown type
self.avatar_mime_type = mimetypes.guess_type(f)[0]
def set_value(self, entry_name, value):
@ -376,8 +377,9 @@ class VcardWindow:
# Avatar
if self.avatar_encoded:
vcard['PHOTO'] = {'TYPE': self.avatar_mime_type,
'BINVAL': self.avatar_encoded}
vcard['PHOTO'] = {'BINVAL': self.avatar_encoded}
if self.avatar_mime_type:
vcard['PHOTO']['TYPE'] = self.avatar_mime_type
return vcard
def on_publish_button_clicked(self, widget):