本文整理汇总了Python中gramps.gen.lib.Address类的典型用法代码示例。如果您正苦于以下问题:Python Address类的具体用法?Python Address怎么用?Python Address使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Address类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_phone
def add_phone(self, fields, data):
"""Read the TEL property of a VCard."""
tel = data.strip()
if tel:
addr = Address()
addr.set_phone(self.unesc(tel))
self.person.add_address(addr)
示例2: column_phone
def column_phone(self,data):
try:
if data[5]:
addr = Address()
addr.unserialize(data[5][0])
return addr.get_phone()
except:
pass
return ''
示例3: add_address
def add_address(self, fields, data):
"""Read the ADR property of a VCard."""
data_fields = self.split_unescaped(data, ';')
data_fields = [x.strip() for x in self.unesc(data_fields)]
if ''.join(data_fields):
addr = Address()
def add_street(strng):
if strng:
already = addr.get_street()
if already:
addr.set_street("%s %s" % (already, strng))
else:
addr.set_street(strng)
addr.add_street = add_street
set_func = ['add_street', 'add_street', 'add_street', 'set_city',
'set_state', 'set_postal_code', 'set_country']
for i, data in enumerate(data_fields):
if i >= len(set_func):
break
getattr(addr, set_func[i])(data)
self.person.add_address(addr)