Open Dutcho opened 7 years ago
@Dutcho, not sure if this is helpful or not. But I playing around with contacts.Person. Was using faker to fill in contacts.Person() attrs. obj.phone = [('Work', fake.phone_number())] Is what i had to do for phone. A list of tuples(label, str). Address for example is a list of tuples(label, dict). Anyway, if its not help just ignore
Thanks @Phuket2
Indeed the contacts.Person
data structure with its multi-strings/-dictionaries needs some getting used to.
BTW, I think the preferred way to label e.g. a phone number is the label constants, so obj.phone = [(contacts.WORK, fake.phone_number())]
in your snippet. The literal 'Work'
will work, but the constant contacts.WORK
enables localization (via contacts.localized_label()
and in the Contacts
iOS App) by using some specific marker chars (like in '_$!<Mobile>!$_'
in original post).
If you don't need that, it doesn't really matter, I guess.
While
contacts.IPHONE
exists in Pythonista's iOS-specific modulecontacts
, the (brand-agnostic)contacts.MOBILE_PHONE
does not, even though"_$!<Mobile>!$_"
is recognized bycontacts.localized_label()
and the constant is mentioned in Apple's documentation. This applies consistently to the documentation.Not a big issue, just an omission. Latest beta, latest iOS.