Skip to content

Commit cddede7

Browse files
author
Richard Jones
committed
fixed roundup-admin "find" to use better value parsing
1 parent d1d7e1e commit cddede7

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Fixed:
1313
- better roundup-server usage string (sf bug 973352)
1414
- include "context" always, as documented (sf bug 965447)
1515
- fixed REMOTE_USER (external HTTP Basic auth) (sf bug 977309)
16+
- fixed roundup-admin "find" to use better value parsing
1617

1718

1819
2004-06-10 0.7.4

roundup/admin.py

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
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 $
2020

2121
'''Administration commands for maintaining Roundup trackers.
2222
'''
@@ -612,32 +612,15 @@ def do_find(self, args):
612612
# handle the propname=value argument
613613
props = self.props_from_args(args[1:])
614614

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()
617616
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
641624

642625
# now do the find
643626
try:

0 commit comments

Comments
 (0)