Commit 50cb4622 authored by Sriram Karra's avatar Sriram Karra

Allow certain types of structured BBDB phone number with dot

BBDB seems liberal about what it allows to remain in the file
and parses as a structured phone number. For e.g. - (["Mobile" 0 0 0 60.8])
is a valid US number, athough the .8 part of the number is not
really displayed on the front end.

ASynK used to barf on such stuff. Now this is fixed; we are more
liberal in what we allow.
parent e9972259
......@@ -628,7 +628,7 @@ class BBPIMDB(PIMDB):
re_ph_vec = ('\[\s*((?P<phlabel>' + res['string'] +
')\s*(?P<number>(?P<unstructured>' +
res['string'] + ')|'+
'(?P<structured>\d+\s+\d+\s+\d+\s+\d+)' +
'(?P<structured>\d+\s+\d+\s+\d+\s+.+)' +
'\s*))\]')
re_phs = 'nil|(\(\s*(' + re_ph_vec + '\s*)+)\)'
res.update({'ph_vec' : re_phs})
......@@ -686,7 +686,7 @@ class BBPIMDB(PIMDB):
re_ph_vec = ('\[\s*((?P<phlabel>' + res['string'] +
')\s*(?P<number>(?P<unstructured>' +
res['string'] + ')|'+
'(?P<structured>\d+\s+\d+\s+\d+\s+\d+)' +
'(?P<structured>\d+\s+\d+\s+\d+\s+.+)' +
'\s*))\]')
re_phs = 'nil|(\(\s*(' + re_ph_vec + '\s*)+)\)'
res.update({'ph_vec' : re_phs})
......
;; -*-coding: utf-8-emacs;-*-
;;; file-format: 7
;;
;; One structurd phone number
;;["John" "Doe" nil nil nil (["Mobile" 0 0 0 60]) nil ("name@gmail.com") ((creation-date . "2013-12-06 14:33:49 +0000") (timestamp . "2013-12-20 17:56:49 +0000")) nil]
;;
;; One structured phone number with a dot notation
["John" "Doe" nil nil nil (["Mobile" 0 0 0 60.8]) nil ("name@gmail.com") ((creation-date . "2013-12-06 14:33:49 +0000") (timestamp . "2013-12-20 17:56:49 +0000")) nil]
;;
;; One Unstructured European style number
["John" "Doe" nil nil nil (["Mobile" "+91 44 2811 2640"]) nil ("name@gmail.com") ((creation-date . "2013-12-06 14:33:49 +0000") (timestamp . "2013-12-20 17:56:49 +0000")) nil]
;;
;; Two variants of structured number
["John" "Doe" nil nil nil (["Mobile" 0 0 0 60.8] ["Mobile" 0 0 0 60]) nil ("name@gmail.com") ((creation-date . "2013-12-06 14:33:49 +0000") (timestamp . "2013-12-20 17:56:49 +0000")) nil]
;;
;; All variants in single entry
["John" "Doe" nil nil nil (["Mobile" 0 0 0 60.8] ["Mobile" 0 0 0 60] ["Mobile" "+91 44 2811 2640"]) nil ("name@gmail.com") ((creation-date . "2013-12-06 14:33:49 +0000") (timestamp . "2013-12-20 17:56:49 +0000")) nil]
......@@ -81,6 +81,7 @@ def main (argv=None):
test_inputs.append(os.path.abspath('data/bb/bbdb.Non-Existent'))
for f in test_inputs:
print "Testing against input file: ", f
run(f)
def run (fn):
......
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