From c4b6cac1b7d3588dfdba32416325c8eb2007f5d8 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 21 Nov 2001 03:40:54 +0000 Subject: [PATCH] more new property handling git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@408 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup-admin | 7 +++++-- roundup/htmltemplate.py | 18 ++++++++++++++++-- roundup/hyperdb.py | 7 ++++++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/roundup-admin b/roundup-admin index e165aa1..bca9aaf 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.45 2001-11-12 22:51:59 jhermann Exp $ +# $Id: roundup-admin,v 1.46 2001-11-21 03:40:54 richard Exp $ import sys if int(sys.version[0]) < 2: @@ -349,7 +349,7 @@ Command help: # TODO: handle > 1 argument # handle the propname=value argument - if prop.find('=') == -1: + if args[1].find('=') == -1: raise UsageError, 'argument "%s" not propname=value'%prop try: propname, value = args[1].split('=') @@ -892,6 +892,9 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.45 2001/11/12 22:51:59 jhermann +# Fixed option & associated error handling +# # Revision 1.44 2001/11/12 22:01:06 richard # Fixed issues with nosy reaction and author copies. # diff --git a/roundup/htmltemplate.py b/roundup/htmltemplate.py index 7ab976b..9d8d7e9 100644 --- a/roundup/htmltemplate.py +++ b/roundup/htmltemplate.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: htmltemplate.py,v 1.41 2001-11-15 10:26:01 richard Exp $ +# $Id: htmltemplate.py,v 1.42 2001-11-21 03:40:54 richard Exp $ import os, re, StringIO, urllib, cgi, errno @@ -51,7 +51,18 @@ class TemplateFunctions: return '[Field: not called from item]' propclass = self.properties[property] if self.nodeid: - value = self.cl.get(self.nodeid, property) + # make sure the property is a valid one + # TODO: this tests, but we should handle the exception + prop_test = self.cl.getprops()[property] + + # get the value for this property + try: + value = self.cl.get(self.nodeid, property) + except KeyError: + # a KeyError here means that the node doesn't have a value + # for the specified property + if isinstance(propclass, hyperdb.Multilink): value = [] + else: value = '' else: # TODO: pull the value from the form if isinstance(propclass, hyperdb.Multilink): value = [] @@ -850,6 +861,9 @@ class NewItemTemplate(TemplateFunctions): # # $Log: not supported by cvs2svn $ +# Revision 1.41 2001/11/15 10:26:01 richard +# . missing "return" in filter_section (thanks Roch'e Compaan) +# # Revision 1.40 2001/11/03 01:56:51 richard # More HTML compliance fixes. This will probably fix the Netscape problem # too. diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py index f1d5c14..cd2e33d 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.32 2001-11-21 03:11:28 richard Exp $ +# $Id: hyperdb.py,v 1.33 2001-11-21 03:40:54 richard Exp $ # standard python modules import cPickle, re, string @@ -305,6 +305,8 @@ class Class: raise ValueError, 'node with key "%s" exists'%value # this will raise the KeyError if the property isn't valid + # ... we don't use getprops() here because we only care about + # the writeable properties. prop = self.properties[key] if isinstance(prop, Link): @@ -847,6 +849,9 @@ def Choice(name, *options): # # $Log: not supported by cvs2svn $ +# Revision 1.32 2001/11/21 03:11:28 richard +# Better handling of new properties. +# # Revision 1.31 2001/11/12 22:01:06 richard # Fixed issues with nosy reaction and author copies. # -- 2.30.2