equal
deleted
inserted
replaced
1 def get_keywords(form, name): |
1 def get_keywords(form, name): |
|
2 """extract keywords associate with field name 'name'.""" |
2 kws = form.getvalue(name) |
3 kws = form.getvalue(name) |
3 if not isinstance(kws, type([])): |
4 if not isinstance(kws, type([])): |
4 if kws: |
5 if kws: |
5 kws = [kws] |
6 kws = [kws] |
6 else: |
7 else: |
7 kws = [] |
8 kws = [] |
8 return map(int, kws) |
9 return map(int, kws) |
9 |
10 |
10 def set_selection(db, bk, sel, exc = []): |
11 def set_selection(db, bk, sel, exc = []): |
|
12 """select keywords selected in the bookmarks list.""" |
11 if len(bk) > 0: |
13 if len(bk) > 0: |
12 ids, names = map(list,apply(zip,db.get_keywords(bk))) |
14 ids, names = map(list,apply(zip,db.get_keywords(bk))) |
13 for key in exc: |
15 for key in exc: |
14 if key not in ids: |
16 if key not in ids: |
15 ids.append(key) |
17 ids.append(key) |