Mercurial > p > roundup > code
diff roundup/htmltemplate.py @ 397:d47818b09265
more new property handling
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 21 Nov 2001 03:40:54 +0000 |
| parents | a9edec536e0a |
| children | bbbcdee47762 |
line wrap: on
line diff
--- a/roundup/htmltemplate.py Wed Nov 21 03:21:13 2001 +0000 +++ b/roundup/htmltemplate.py Wed Nov 21 03:40:54 2001 +0000 @@ -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 @@ 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 @@ # # $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.
