Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 230:e17a43d2c0d0
all searches use re now - and they're all case insensitive
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 16 Aug 2001 06:59:58 +0000 |
| parents | 1d1848c99abe |
| children | afd428ba6523 |
comparison
equal
deleted
inserted
replaced
| 229:df77ba2e489c | 230:e17a43d2c0d0 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: hyperdb.py,v 1.16 2001-08-15 23:43:18 richard Exp $ | 18 # $Id: hyperdb.py,v 1.17 2001-08-16 06:59:58 richard Exp $ |
| 19 | 19 |
| 20 # standard python modules | 20 # standard python modules |
| 21 import cPickle, re, string | 21 import cPickle, re, string |
| 22 | 22 |
| 23 # roundup modules | 23 # roundup modules |
| 569 elif isinstance(propclass, String): | 569 elif isinstance(propclass, String): |
| 570 if '*' in v or '?' in v: | 570 if '*' in v or '?' in v: |
| 571 # simple glob searching | 571 # simple glob searching |
| 572 v = v.replace('?', '.') | 572 v = v.replace('?', '.') |
| 573 v = v.replace('*', '.*?') | 573 v = v.replace('*', '.*?') |
| 574 v = re.compile(v) | 574 l.append((2, k, re.compile(v, re.I))) |
| 575 l.append((2, k, v)) | |
| 576 elif v[0] == '^': | |
| 577 # start-anchored | |
| 578 if v[-1] == '$': | |
| 579 # _and_ end-anchored | |
| 580 l.append((6, k, v[1:-1])) | |
| 581 l.append((3, k, v[1:])) | |
| 582 elif v[-1] == '$': | |
| 583 # end-anchored | |
| 584 l.append((4, k, v[:-1])) | |
| 585 else: | |
| 586 # substring | |
| 587 l.append((5, k, v)) | |
| 588 else: | 575 else: |
| 589 l.append((6, k, v)) | 576 l.append((6, k, v)) |
| 590 filterspec = l | 577 filterspec = l |
| 591 | 578 |
| 592 # now, find all the nodes that are active and pass filtering | 579 # now, find all the nodes that are active and pass filtering |
| 613 continue | 600 continue |
| 614 break | 601 break |
| 615 elif t == 2 and not v.search(node[k]): | 602 elif t == 2 and not v.search(node[k]): |
| 616 # RE search | 603 # RE search |
| 617 break | 604 break |
| 618 elif t == 3 and node[k][:len(v)] != v: | 605 # elif t == 3 and node[k][:len(v)] != v: |
| 619 # start anchored | 606 # # start anchored |
| 620 break | 607 # break |
| 621 elif t == 4 and node[k][-len(v):] != v: | 608 # elif t == 4 and node[k][-len(v):] != v: |
| 622 # end anchored | 609 # # end anchored |
| 623 break | 610 # break |
| 624 elif t == 5 and node[k].find(v) == -1: | 611 # elif t == 5 and node[k].find(v) == -1: |
| 625 # substring search | 612 # # substring search |
| 626 break | 613 # break |
| 627 elif t == 6 and node[k] != v: | 614 elif t == 6 and node[k] != v: |
| 628 # straight value comparison for the other types | 615 # straight value comparison for the other types |
| 629 break | 616 break |
| 630 else: | 617 else: |
| 631 l.append((nodeid, node)) | 618 l.append((nodeid, node)) |
| 805 cl.create(name=option[i], order=i) | 792 cl.create(name=option[i], order=i) |
| 806 return hyperdb.Link(name) | 793 return hyperdb.Link(name) |
| 807 | 794 |
| 808 # | 795 # |
| 809 # $Log: not supported by cvs2svn $ | 796 # $Log: not supported by cvs2svn $ |
| 797 # Revision 1.16 2001/08/15 23:43:18 richard | |
| 798 # Fixed some isFooTypes that I missed. | |
| 799 # Refactored some code in the CGI code. | |
| 800 # | |
| 810 # Revision 1.15 2001/08/12 06:32:36 richard | 801 # Revision 1.15 2001/08/12 06:32:36 richard |
| 811 # using isinstance(blah, Foo) now instead of isFooType | 802 # using isinstance(blah, Foo) now instead of isFooType |
| 812 # | 803 # |
| 813 # Revision 1.14 2001/08/07 00:24:42 richard | 804 # Revision 1.14 2001/08/07 00:24:42 richard |
| 814 # stupid typo | 805 # stupid typo |
