myPIM

Check-in [c940af332c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make search case insensitive
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | master | trunk
Files: files | file ages | folders
SHA3-256:c940af332c5cea02e526ab0f40f577afc876f376640d36326f0540ca831b722c
User & Date: vandys 2018-10-04 04:41:55
Context
2018-10-04
04:41
Make search case insensitive Leaf check-in: c940af332c user: vandys tags: master, trunk
2018-07-07
15:26
Add some notes on the DB format check-in: d776dfe659 user: vandys tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to mm.py.

3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18

19

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import pim

# Overall collection of open PIM DBs, concatenated
db = None

# Dump out all People entries whose "name" field contains this string
def search_names(persons, str):

    for p in persons:
	if p.name.find(str) >= 0:
	    p.display()
	    print
	elif p.nick and p.nick.find(str) >= 0:
	    p.display()
	    print

# Dump out People entries where ANY field matches the string

def search_allnames(persons, str):

    for p in persons:
	# Check fixed fields first
	if (p.name.find(str) >= 0) or \
		(p.nick and (p.nick.find(str) >= 0)) or \
		(p.comment.find(str) >= 0):
	    p.display()
	    print
	    continue

	# Sweep addresses
	found = False
	for a in p.addresses.itervalues():
	    if a.find(str) >= 0:
		p.display()
		print
		found = True
		break
	if found:
	    continue

	# Sweep E-mail addresses and phone numbers
	for a in itertools.chain(p.email.itervalues(),
		p.phones.itervalues()):
	    if a.find(str) >= 0:
		p.display()
		print
		break

def w(str):
    sys.stderr.write(str)








>

|


|




>

>


|









|










|







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import pim

# Overall collection of open PIM DBs, concatenated
db = None

# Dump out all People entries whose "name" field contains this string
def search_names(persons, str):
    str = str.lower()
    for p in persons:
	if p.name.lower().find(str) >= 0:
	    p.display()
	    print
	elif p.nick and p.nick.lower().find(str) >= 0:
	    p.display()
	    print

# Dump out People entries where ANY field matches the string
# Case insensitive
def search_allnames(persons, str):
    str = str.lower()
    for p in persons:
	# Check fixed fields first
	if (p.name.lower().find(str) >= 0) or \
		(p.nick and (p.nick.find(str) >= 0)) or \
		(p.comment.find(str) >= 0):
	    p.display()
	    print
	    continue

	# Sweep addresses
	found = False
	for a in p.addresses.itervalues():
	    if a.lower().find(str) >= 0:
		p.display()
		print
		found = True
		break
	if found:
	    continue

	# Sweep E-mail addresses and phone numbers
	for a in itertools.chain(p.email.itervalues(),
		p.phones.itervalues()):
	    if a.lower().find(str) >= 0:
		p.display()
		print
		break

def w(str):
    sys.stderr.write(str)