Skip to content

Commit

Permalink
BBDB notes_map web_home_re / web_work_re were not being used
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
skarra committed Oct 28, 2016
1 parent 9278e09 commit 2f3a37a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
19 changes: 17 additions & 2 deletions asynk/contact_bb.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,21 +578,36 @@ def _get_emails_as_string (self):
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))
Expand Down
4 changes: 2 additions & 2 deletions config/config_v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 2f3a37a

Please sign in to comment.