Commit 2f3a37a5 authored by Sriram Karra's avatar Sriram Karra

BBDB notes_map web_home_re / web_work_re were not being used

This fixes #103, but it is only a hack. Need to rethink
the original idea of allowing regexp in the notes_map, or at least
make it a list of two values - a regexp to match at read time
and a pattern string to generate a label to write out.

At any rate the present hacky fix will work for those who are
using a single website per contact.
parent 9278e097
......@@ -578,21 +578,36 @@ class BBContact(Contact):
def _get_websites_as_string (self):
## FIXME: What happens to the "get_web_prim()".
noted = self.get_notes_map()
ret = []
home_label = noted['web_home_re']
for i, web in enumerate(self.get_web_home()):
if not web:
continue
label = 'Web-%02d-Home' % i
## FIXME: Hack Alert. There is no easy way to regenerate proper
## labels with the regex. Need to rethink this a bit. Perhaps
## there needs to be a patter to match, and a python pattern to
## generate them at the remote end.
if home_label == 'Web.*Home':
label = 'Web-%02d-Home' % i
else:
label = home_label
value = unchompq(esc_str(web))
ret.append("(%s . %s)" % (label, value))
work_label = noted['web_work_re']
for i, web in enumerate(self.get_web_work()):
if not web:
continue
label = 'Web-%02d-Work' % i
## FIXME: Hack Alert. See above
if work_label == 'Web.*Work':
label = 'Web-%02d-Work' % i
else:
label = work_label
value = unchompq(esc_str(web))
ret.append("(%s . %s)" % (label, value))
......
......@@ -283,8 +283,8 @@
'birthday' : 'birthday',
'anniv' : 'anniversary',
'itemid' : 'bbdb-id',
'web_home_re' : 'Web.*Home', // Regexp
'web_work_re' : 'Web.*Work', // Regexp
'web_home_re' : 'Web.*Home', // Regexp. FIXME. See Issue 103.
'web_work_re' : 'Web.*Work', // Regexp. FIXME. See Issue 103.
'ims' : 'im-(.*)', // Regexp brackets are important.
'dept' : 'department',
'title' : 'title',
......
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