Mercurial > p > roundup > code
diff roundup/cgi/client.py @ 1442:b42fa71754c9
don't attempt to create FileClass items if no content is supplied
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 18 Feb 2003 01:57:39 +0000 |
| parents | 13c42b803101 |
| children | 55d16d2b39cc |
line wrap: on
line diff
--- a/roundup/cgi/client.py Tue Feb 18 01:48:39 2003 +0000 +++ b/roundup/cgi/client.py Tue Feb 18 01:57:39 2003 +0000 @@ -1,4 +1,4 @@ -# $Id: client.py,v 1.89 2003-02-17 06:44:00 richard Exp $ +# $Id: client.py,v 1.90 2003-02-18 01:57:39 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -1169,6 +1169,10 @@ :file - create a file, attach to the current item and any message created by :note. This is ALWAYS designated "file-1". + + We also check that FileClass items have a "content" property with + actual content, otherwise we remove them from all_props before + returning. ''' # some very useful variables db = self.db @@ -1512,6 +1516,15 @@ if s: raise ValueError, '\n'.join(s) + # check that FileClass entries have a "content" property with + # content, otherwise remove them + for (cn, id), props in all_props.items(): + cl = self.db.classes[cn] + if not isinstance(cl, hyperdb.FileClass): + continue + if not props.get('content', ''): + del all_props((cn, id)) + return all_props, all_links def fixNewlines(text):
