One function

make_vcard_data in heuer/segno

The author described this change as Fixed bug in birthday representation of the vCard implementation. It counts as a record because the check below fails on the code as it stood at f843e2090 and passes on da59519bc, with nothing else changed between the two runs.

Fix saved2019-12-21
Sharing licenceBSD-3-Clause · LICENSE
Change size+1 1

What the code was meant to do, written into the code itself as a docstring

Creates a string encoding the contact information as vCard 3.0. Only a subset of available `vCard 3.0 properties <https://tools.ietf.org/html/rfc2426>` is supported. :param str name: The name. If it contains a semicolon, , the first part is treated as lastname and the second part is treated as forename. :param str displayname: Common name. :param email: E-mail address. Multiple values are allowed. :type email: str, iterable of strings, or None :param phone: Phone number. Multiple values are allowed. :type phone: str, iterable of strings, or None :param fax: Fax number. Multiple values are allowed. :type fax: str, iterable of strings, or None :param videophone: Phone number for video calls. Multiple values are allowed. :type videophone: str, iterable of strings, or None :param memo: A notice for the contact. :type memo: str or None :param nickname: Nickname. :type nickname: str or None :param birthday: Birthday. If a string is provided, it should encode the date as `YYYY-MM-DD` value. :type birthday: str, datetime.date or None :param url: Homepage. Multiple values are allowed. :type url: str, iterable of strings, or None :param pobox: P.O. box (address information). :type pobox: str or None :param street: Street address. :type street: str or None :param city: City (address information). :type city: str or None :param region: Region (address information). :type region: str or None :param zipcode: Zip code (address information). :type zipcode: str or None :param country: Country (address information). :type country: str or None :param org: Company / organization name. :type org: str or None :param lat: Latitude. :type lat: float or None :param lng: Longitude. :type lng: float or None :param source: URL where to obtain the vCard. :type source: str or None :param rev: Revision of the vCard / last modification date. :type rev: str, datetime.date or None :param title: Job Title. Multiple values are allowed. :type title: str, iterable of strings, or None :param photo_uri: Photo URI. Multiple values are allowed. :type photo_uri: str, iterable of strings, or None :rtype: str

The change

9090 pass
9191 if not _looks_like_datetime(birthday):
9292 raise ValueError('"birthday" does not seem to be a valid date or date/time representation')
93- data.append('BDAY:{0};'.format(birthday))
93+ data.append('BDAY:{0}'.format(birthday))
9494 if lat or lng and (not(all((lat, lng)))):
9595 raise ValueError('Incomplete geo information, please specify latitude and longitude.')
9696 if lat and lng:

The check that tells the two apart

failpass·tests/test_helpers.py::test_vcard_data_valid_bday

Check file tests/test_helpers.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itf843e2090bf9587cda317398ec2c978c70c6eda4
Broken version dated2019-12-21
Modulesegno.helpers
Units changedmake_vcard_data
Fingerprint1f4d72f065d478d0
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in heuer/segno