Commit 84122457 authored by Sriram Karra's avatar Sriram Karra

New method Contact.get_disp_name() for printing some name in messages.

parent 46bf248c
##
## Created : Tue Mar 13 14:26:01 IST 2012
## Last Modified : Wed May 16 23:11:43 IST 2012
## Last Modified : Thu Aug 09 12:16:02 IST 2012
##
## Copyright (C) 2012 Sriram Karra <karra.etc@gmail.com>
##
......@@ -140,6 +140,20 @@ class Contact(Item):
self._set_prop('name', val)
return val
def get_disp_name (self):
"""In many cases we just want some name to be displayed - in debug
messages, etc. which has to be built from a number of fields. This
routine does that."""
n = self.get_name()
if not n:
n = self.get_firstname()
if not n:
n = ''
n += self.get_lastname()
return n
def get_prefix (self):
return self._get_prop('prefix')
......
......@@ -680,7 +680,7 @@ class OLContact(Contact):
val = self._get_olprop(olpd, tag)
if not val:
logging.debug('con_ol:scpfo: No custom props found: %s',
self.get_name())
self.get_disp_name())
return
d = demjson.decode(val)
......
##
## Created : Wed May 18 13:16:17 IST 2011
## Last Modified : Sun Jul 01 12:04:17 IST 2012
## Last Modified : Thu Aug 09 12:16:13 IST 2012
##
## Copyright (C) 2011, 2012 Sriram Karra <karra.etc@gmail.com>
##
......@@ -225,10 +225,10 @@ class OLFolder(Folder):
try:
eid = olc.save()
logging.info('Successfully created outlook entry for %30s (%s)',
olc.get_name(), olc.get_itemid())
olc.get_disp_name(), olc.get_itemid())
except Exception, e:
logging.error('Could not save contact (%s) due to: %s',
olc.get_name(), str(e))
olc.get_disp_name(), str(e))
logging.debug('Contact Entry: %s', olc)
logging.debug(traceback.format_exc())
success = False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment