diff --git a/gramps/plugins/importer/importvcard.py b/gramps/plugins/importer/importvcard.py index 9c0104fdb..20d216279 100644 --- a/gramps/plugins/importer/importvcard.py +++ b/gramps/plugins/importer/importvcard.py @@ -20,8 +20,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# $Id$ - "Import from vCard (RFC 2426)" #------------------------------------------------------------------------- @@ -484,12 +482,15 @@ class VCardParser(object): ).format(date=e.date.to_struct(), vcard_snippet=data)) date.set(modifier=Date.MOD_TEXTONLY, text=data) else: - # TRANSLATORS: leave the {vcard_snippet} untranslated. - LOG.warning(_( - "Date {vcard_snippet} not in appropriate format yyyy-mm-dd, " - "preserving date as text." - ).format(vcard_snippet=date_str)) - date.set(modifier=Date.MOD_TEXTONLY, text=date_str) + if date_str: + # TRANSLATORS: leave the {vcard_snippet} untranslated. + LOG.warning(_( + "Date {vcard_snippet} not in appropriate format yyyy-mm-dd, " + "preserving date as text." + ).format(vcard_snippet=date_str)) + date.set(modifier=Date.MOD_TEXTONLY, text=date_str) + else: # silently ignore an empty BDAY record + return event = Event() event.set_type(EventType(EventType.BIRTH)) event.set_date_object(date) diff --git a/gramps/plugins/importer/test/importvcard_test.py b/gramps/plugins/importer/test/importvcard_test.py index 6db458c63..ee3e5139d 100644 --- a/gramps/plugins/importer/test/importvcard_test.py +++ b/gramps/plugins/importer/test/importvcard_test.py @@ -486,10 +486,6 @@ class VCardCheck(unittest.TestCase): ET.SubElement(event, 'dateval', {'val': '2001-09-28'}) self.do_test("\r\n".join(self.vcard), self.gramps) - def test_add_birthday_ddmmyyyy(self): - self.vcard.insert(4, "BDAY:28-09-2001") - self.do_test("\r\n".join(self.vcard), self.gramps) - def test_add_birthday_empty(self): self.vcard.insert(4, "BDAY: ") self.do_test("\r\n".join(self.vcard), self.gramps)