Skip to content

Commit 8a3a169

Browse files
author
Johannes Gijsbers
committed
Fixed editing properties on FileClass nodes.
Previously, if there was no 'content' property in the form when editing properties, other changes wold be discarded silently. Now, an exception is raised when there is a empty content property. Also, when there is no content property, other attributes can be edited.
1 parent ef57248 commit 8a3a169

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

roundup/cgi/client.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.127 2003-08-10 10:30:56 jlgijsbers Exp $
1+
# $Id: client.py,v 1.128 2003-08-10 13:38:43 jlgijsbers Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -1953,15 +1953,17 @@ def parsePropsFromForm(self, num_re=re.compile('^\d+$')):
19531953
if s:
19541954
raise ValueError, '\n'.join(s)
19551955

1956-
# check that FileClass entries have a "content" property with
1957-
# content, otherwise remove them
1956+
# When creating a FileClass node, it should have a non-empty content
1957+
# property to be created. When editing a FileClass node, it should
1958+
# either have a non-empty content property or no property at all. In
1959+
# the latter case, nothing will change.
19581960
for (cn, id), props in all_props.items():
1959-
cl = self.db.classes[cn]
1960-
if not isinstance(cl, hyperdb.FileClass):
1961-
continue
1962-
# we also don't want to create FileClass items with no content
1963-
if not props.get('content', ''):
1964-
del all_props[(cn, id)]
1961+
if isinstance(self.db.classes[cn], hyperdb.FileClass):
1962+
if id == '-1':
1963+
if not props.get('content', ''):
1964+
del all_props[(cn, id)]
1965+
elif props.has_key('content') and not props['content']:
1966+
raise ValueError, _('File is empty')
19651967
return all_props, all_links
19661968

19671969
def fixNewlines(text):

0 commit comments

Comments
 (0)