本文整理汇总了Python中contact.Contact.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Contact.__init__方法的具体用法?Python Contact.__init__怎么用?Python Contact.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类contact.Contact
的用法示例。
在下文中一共展示了Contact.__init__方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import __init__ [as 别名]
def __init__ (self, folder, con=None, con_itemid=None, rec=None):
"""rec is the native string vector representation of a BBDB contact
entry on disk."""
Contact.__init__(self, folder, con)
self.atts.update({'bbdb_folder' : None,})
conf = self.get_config()
if con:
if con_itemid:
self.set_itemid(con_itemid)
else:
logging.debug('Potential new BBContact: %s', con.get_name())
if folder.get_name():
self.set_bbdb_folder(folder.get_name())
if rec:
self.set_rec(rec)
self.init_props_from_rec(rec)
if not self.get_itemid():
iid = ('%s' % uuid.uuid1())
logging.debug('Assigning UUID %s for new contact: %s', iid,
self.get_name())
self.set_itemid(iid)
self.in_init(False)
示例2: __init__
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import __init__ [as 别名]
def __init__ (self, folder, con=None, vco=None, itemid=None):
"""vco, if not None, should be a valid vCard object (i.e. the contents
of a vCard file, for e.g. When vco is not None, itemid should also be
not None"""
Contact.__init__(self, folder, con)
self.set_etag(None)
self.set_uid(None)
self.set_vco(vco)
self._group_count = 0
## Sometimes we might be creating a contact object from a Google
## contact object or other entry which might have the ID in its sync
## tags field. if that is present, we should use it to initialize the
## itemid field for the current object
conf = self.get_config()
if con:
try:
pname_re = conf.get_profile_name_re()
label = conf.make_sync_label(pname_re, self.get_dbid())
tag, itemid = con.get_sync_tags(label)[0]
self.set_itemid(itemid)
except Exception, e:
logging.debug('Potential new CDContact: %s', con.get_name())
示例3: __init__
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import __init__ [as 别名]
def __init__ (self, folder, olprops=None, eid=None, con=None):
"""Constructor for OLContact. The starting properties of the contact
can be initialized either from an existing Contact object, or from an
Outlook item property list. It is an error to provide both.
It is redundant to provide both olprops (array of property tuples) and
an entryid. The entryid will override the property list.
"""
if ((olprops and con) or (eid and con)):
raise OLContactError(
'Both olprops/eid and con cannot be specified in OLContact()')
if olprops and eid:
logging.warning('olprops and eid are not null. Ignoring olprops')
olprops = None
Contact.__init__(self, folder, con)
## Sometimes we might be creating a contact object from GC or other
## entry which might have the Entry ID in its sync tags
## field. if that is present, we should use it to initialize the
## itemid field for the current object
conf = self.get_config()
if con:
try:
pname_re = conf.get_profile_name_re()
label = conf.make_sync_label(pname_re, self.get_dbid())
tag, itemid = con.get_sync_tags(label)[0]
self.set_entryid(base64.b64decode(itemid))
except Exception, e:
logging.debug('Potential new OLContact: %s', con.get_name())
示例4: __init__
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import __init__ [as 别名]
def __init__ (self, folder, con=None, con_itemid=None, vco=None, itemid=None,
debug_vcf=False):
"""vco, if not None, should be a valid vCard object (i.e. the contents
of a vCard file, for e.g. When vco is not None, itemid should also be
not None"""
Contact.__init__(self, folder, con)
self.debug_vcf = debug_vcf
self.set_etag(None)
self.set_uid(None)
self.set_vco(vco)
self._group_count = 0
conf = self.get_config()
if con:
if con_itemid:
self.set_itemid(self.normalize_cdid(con_itemid))
else:
logging.debug('Potential new CDContact: %s', con.get_name())
elif vco:
self.init_props_from_vco(vco)
if not self.debug_vcf:
assert(itemid)
self.set_itemid(itemid)
self.in_init(False)
if not self.get_uid():
self.set_uid(str(uuid.uuid1()))
示例5: __init__
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import __init__ [as 别名]
def __init__ (self, folder, con=None, rec=None):
"""rec is the native string vector representation of a BBDB contact
entry on disk."""
Contact.__init__(self, folder, con)
self.atts.update({'bbdb_folder' : None,})
## Sometimes we might be creating a contact object from a Google
## contact object or other entry which might have the ID in its sync
## tags field. if that is present, we should use it to initialize the
## itemid field for the current object
conf = self.get_config()
if con:
try:
pname_re = conf.get_profile_name_re()
label = conf.make_sync_label(pname_re, self.get_dbid())
tag, itemid = con.get_sync_tags(label)[0]
self.set_itemid(itemid)
except Exception, e:
logging.debug('Potential new BBContact: %s', con.get_name())
if folder.get_name():
self.set_bbdb_folder(folder.get_name())
示例6: __init__
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import __init__ [as 别名]
def __init__ (self, folder, ews_con=None, con=None):
"""Constructor for EXContact. The starting properties of the contact
can be initialized either from an existing Contact object, or from an
pyews contact object. It is an error to provide both.
"""
if (ews_con and con):
raise EXContactError(
'Both ews con and con cannot be specified in EXContact()')
Contact.__init__(self, folder, con)
## Sometimes we might be creating a contact object from a remote
## source which might have the Entry ID in its sync tags field. if
## that is present, we should use it to initialize the itemid field
## for the current object
conf = self.get_config()
if con:
try:
pname_re = conf.get_profile_name_re()
label = conf.make_sync_label(pname_re, self.get_dbid())
tag, itemid = con.get_sync_tags(label)[0]
self.set_itemid(itemid)
except Exception, e:
logging.debug('Potential new EXContact: %s', con.get_disp_name())
示例7: __init__
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import __init__ [as 别名]
def __init__(self, folder, con=None, con_itemid=None, gce=None):
Contact.__init__(self, folder, con)
conf = self.get_config()
if con:
if con_itemid:
self.set_itemid(self.normalize_gcid(con_itemid))
else:
logging.debug("Potential new GCContact: %s", con.get_disp_name())
self.set_gce(gce)
if gce:
self.init_props_from_gce(gce)
self.in_init(False)
示例8: __init__
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import __init__ [as 别名]
def __init__(self, folder, con=None, gce=None):
Contact.__init__(self, folder, con)
## Sometimes we might be creating a contact object from Outlook or
## other entry which might have the google contact ID in its sync tags
## field. if that is present, we should use it to initialize the
## itemid field for the current object
conf = self.get_config()
if con:
try:
pname_re = conf.get_profile_name_re()
label = conf.make_sync_label(pname_re, self.get_dbid())
tag, itemid = con.get_sync_tags(label)[0]
self.set_itemid(self.normalize_gcid(itemid))
except Exception, e:
logging.debug("Potential new GCContact: %s", con.get_name())
示例9: __init__
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import __init__ [as 别名]
def __init__ (self, folder, ews_con=None, con=None, con_itemid=None):
"""Constructor for EXContact. The starting properties of the contact
can be initialized either from an existing Contact object, or from an
pyews contact object. It is an error to provide both.
"""
if (ews_con and con):
raise EXContactError(
'Both ews con and con cannot be specified in EXContact()')
Contact.__init__(self, folder, con)
conf = self.get_config()
if con:
if con_itemid:
self.set_itemid(con_itemid)
else:
logging.debug('Potential new EXContact: %s', con.get_disp_name())
self.set_ews_con(ews_con)
if ews_con is not None:
self.init_props_from_ews_con(ews_con)
示例10: __init__
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import __init__ [as 别名]
def __init__ (self, folder, olprops=None, eid=None, con=None,
con_itemid=None):
"""Constructor for OLContact. The starting properties of the contact
can be initialized either from an existing Contact object, or from an
Outlook item property list. It is an error to provide both.
It is redundant to provide both olprops (array of property tuples) and
an entryid. The entryid will override the property list.
"""
if ((olprops and con) or (eid and con)):
raise OLContactError(
'Both olprops/eid and con cannot be specified in OLContact()')
if olprops and eid:
logging.warning('olprops and eid are not null. Ignoring olprops')
olprops = None
Contact.__init__(self, folder, con)
conf = self.get_config()
if con:
if con_itemid:
self.set_entryid(base64.b64decode(con_itemid))
else:
logging.debug('Potential new OLContact: %s', con.get_name())
## Set up some of the basis object attributes and parent folder/db
## properties to make it easier to access them
self.set_synchable_fields_list()
self.set_proptags(folder.get_proptags())
pvalu = self.get_proptags().valu
self.addr_map = {
'work' : {
'street' : pvalu('ASYNK_PR_WORK_ADDRESS_STREET'),
'city' : pvalu('ASYNK_PR_WORK_ADDRESS_CITY'),
'state' : pvalu('ASYNK_PR_WORK_ADDRESS_STATE_OR_PROVINCE'),
'country' : pvalu('ASYNK_PR_WORK_ADDRESS_COUNTRY'),
'zip' : pvalu('ASYNK_PR_WORK_ADDRESS_POSTAL_CODE')
},
'home' : {
'street' : mt.PR_HOME_ADDRESS_STREET_W,
'city' : mt.PR_HOME_ADDRESS_CITY_W,
'state' : mt.PR_HOME_ADDRESS_STATE_OR_PROVINCE_W,
'country' : mt.PR_HOME_ADDRESS_COUNTRY_W,
'zip' : mt.PR_HOME_ADDRESS_POSTAL_CODE_W,
},
'other' : {
'street' : mt.PR_OTHER_ADDRESS_STREET_W,
'city' : mt.PR_OTHER_ADDRESS_CITY_W,
'state' : mt.PR_OTHER_ADDRESS_STATE_OR_PROVINCE_W,
'country' : mt.PR_OTHER_ADDRESS_COUNTRY_W,
'zip' : mt.PR_OTHER_ADDRESS_POSTAL_CODE_W,
},
}
self.set_olprops(olprops)
if olprops:
self.init_props_from_olprops(olprops)
elif eid:
self.init_props_from_eid(eid)
self.in_init(False)