|
16 | 16 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
17 | 17 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
18 | 18 | # |
19 | | -# $Id: admin.py,v 1.68.2.1 2004-06-13 00:40:55 richard Exp $ |
| 19 | +# $Id: admin.py,v 1.68.2.2 2004-06-23 22:59:17 richard Exp $ |
20 | 20 |
|
21 | 21 | '''Administration commands for maintaining Roundup trackers. |
22 | 22 | ''' |
@@ -612,32 +612,15 @@ def do_find(self, args): |
612 | 612 | # handle the propname=value argument |
613 | 613 | props = self.props_from_args(args[1:]) |
614 | 614 |
|
615 | | - # if the value isn't a number, look up the linked class to get the |
616 | | - # number |
| 615 | + # convert the user-input value to a value used for find() |
617 | 616 | for propname, value in props.items(): |
618 | | - num_re = re.compile('^\d+$') |
619 | | - if value == '-1': |
620 | | - props[propname] = None |
621 | | - elif not num_re.match(value): |
622 | | - # get the property |
623 | | - try: |
624 | | - property = cl.properties[propname] |
625 | | - except KeyError: |
626 | | - raise UsageError, _('%(classname)s has no property ' |
627 | | - '"%(propname)s"')%locals() |
628 | | - |
629 | | - # make sure it's a link |
630 | | - if (not isinstance(property, hyperdb.Link) and not |
631 | | - isinstance(property, hyperdb.Multilink)): |
632 | | - raise UsageError, _('You may only "find" link properties') |
633 | | - |
634 | | - # get the linked-to class and look up the key property |
635 | | - link_class = self.db.getclass(property.classname) |
636 | | - try: |
637 | | - props[propname] = link_class.lookup(value) |
638 | | - except TypeError: |
639 | | - raise UsageError, _('%(classname)s has no key property"')%{ |
640 | | - 'classname': link_class.classname} |
| 617 | + if ',' in value: |
| 618 | + values = value.split(',') |
| 619 | + else: |
| 620 | + values = [] |
| 621 | + d = props[propname] = {} |
| 622 | + for value in values: |
| 623 | + d[hyperdb.rawToHyperdb(self.db, cl, None, propname, value)] = 1 |
641 | 624 |
|
642 | 625 | # now do the find |
643 | 626 | try: |
|
0 commit comments