From b54b71e1e8b25638c31c7e82dad8bb695bf24db7 Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 16 Oct 2001 03:48:01 +0000 Subject: [PATCH] admin tool now complains if a "find" is attempted with a non-link property. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@304 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup-admin | 17 ++++++++++++----- roundup/hyperdb.py | 17 +++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/roundup-admin b/roundup-admin index f301ff0..d3b5d65 100755 --- a/roundup-admin +++ b/roundup-admin @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup-admin,v 1.28 2001-10-13 00:07:39 richard Exp $ +# $Id: roundup-admin,v 1.29 2001-10-16 03:48:01 richard Exp $ import sys if int(sys.version[0]) < 2: @@ -233,9 +233,9 @@ def do_set(db, args, comma_sep=0): def do_find(db, args, comma_sep=0): '''Usage: find classname propname=value ... - Find the nodes of the given class with a given property value. + Find the nodes of the given class with a given link property value. - Find the nodes of the given class with a given property value. The + Find the nodes of the given class with a given link property value. The value may be either the nodeid of the linked node, or its key value. ''' classname = args[0] @@ -245,8 +245,12 @@ def do_find(db, args, comma_sep=0): propname, value = args[1].split('=') num_re = re.compile('^\d+$') if not num_re.match(value): - propcl = cl.properties[propname].classname - propcl = db.getclass(propcl) + propcl = cl.properties[propname] + if (not isinstance(propcl, hyperdb.Link) and not + isinstance(type, hyperdb.Multilink)): + print 'You may only "find" link properties' + return 1 + propcl = db.getclass(propcl.classname) value = propcl.lookup(value) # now do the find @@ -597,6 +601,9 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.28 2001/10/13 00:07:39 richard +# More help in admin tool. +# # Revision 1.27 2001/10/11 23:43:04 richard # Implemented the comma-separated printing option in the admin tool. # Fixed a typo (more of a vim-o actually :) in mailgw. diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py index 528582f..dbca837 100644 --- a/roundup/hyperdb.py +++ b/roundup/hyperdb.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: hyperdb.py,v 1.25 2001-10-11 00:17:51 richard Exp $ +# $Id: hyperdb.py,v 1.26 2001-10-16 03:48:01 richard Exp $ # standard python modules import cPickle, re, string @@ -644,15 +644,6 @@ class Class: elif t == 2 and not v.search(node[k]): # RE search break -# elif t == 3 and node[k][:len(v)] != v: -# # start anchored -# break -# elif t == 4 and node[k][-len(v):] != v: -# # end anchored -# break -# elif t == 5 and node[k].find(v) == -1: -# # substring search -# break elif t == 6 and node[k] != v: # straight value comparison for the other types break @@ -849,6 +840,12 @@ def Choice(name, *options): # # $Log: not supported by cvs2svn $ +# Revision 1.25 2001/10/11 00:17:51 richard +# Reverted a change in hyperdb so the default value for missing property +# values in a create() is None and not '' (the empty string.) This obviously +# breaks CSV import/export - the string 'None' will be created in an +# export/import operation. +# # Revision 1.24 2001/10/10 03:54:57 richard # Added database importing and exporting through CSV files. # Uses the csv module from object-craft for exporting if it's available. -- 2.30.2