Mercurial > p > roundup > code
comparison roundup/cgi/form_parser.py @ 4049:c9a8a47c4666
Do not try to create empty nodes with a negative ID.
| author | Stefan Seefeld <stefan@seefeld.name> |
|---|---|
| date | Thu, 19 Feb 2009 20:00:44 +0000 |
| parents | 3167ad1c19cd |
| children | a412ce8ccf6f |
comparison
equal
deleted
inserted
replaced
| 4048:7ad0918ee8bd | 4049:c9a8a47c4666 |
|---|---|
| 561 # When creating a FileClass node, it should have a non-empty content | 561 # When creating a FileClass node, it should have a non-empty content |
| 562 # property to be created. When editing a FileClass node, it should | 562 # property to be created. When editing a FileClass node, it should |
| 563 # either have a non-empty content property or no property at all. In | 563 # either have a non-empty content property or no property at all. In |
| 564 # the latter case, nothing will change. | 564 # the latter case, nothing will change. |
| 565 for (cn, id), props in all_props.items(): | 565 for (cn, id), props in all_props.items(): |
| 566 if id and id.startswith('-') and not props: | 566 if id is not None and id.startswith('-') and not props: |
| 567 # new item (any class) with no content - ignore | 567 # new item (any class) with no content - ignore |
| 568 del all_props[(cn, id)] | 568 del all_props[(cn, id)] |
| 569 elif isinstance(self.db.classes[cn], hyperdb.FileClass): | 569 elif isinstance(self.db.classes[cn], hyperdb.FileClass): |
| 570 if id and id.startswith('-'): | 570 if id is not None and id.startswith('-'): |
| 571 if not props.get('content', ''): | 571 if not props.get('content', ''): |
| 572 del all_props[(cn, id)] | 572 del all_props[(cn, id)] |
| 573 elif props.has_key('content') and not props['content']: | 573 elif props.has_key('content') and not props['content']: |
| 574 raise FormError, self._('File is empty') | 574 raise FormError, self._('File is empty') |
| 575 return all_props, all_links | 575 return all_props, all_links |
