comparison roundup/cgi/form_parser.py @ 5149:cc4f4ee46d88

Fix file attribute parsing Fix bug introduced when allowing multiple file attachments.
author Ralf Schlatterbeck <rsc@runtux.com>
date Mon, 18 Jul 2016 13:21:43 +0200
parents e424987d294a
children 2ae3954e972f
comparison
equal deleted inserted replaced
5148:71643a839c80 5149:cc4f4ee46d88
592 for (cn, id), props in all_props.items(): 592 for (cn, id), props in all_props.items():
593 if id is not None and id.startswith('-') and not props: 593 if id is not None and id.startswith('-') and not props:
594 # new item (any class) with no content - ignore 594 # new item (any class) with no content - ignore
595 del all_props[(cn, id)] 595 del all_props[(cn, id)]
596 elif isinstance(self.db.classes[cn], hyperdb.FileClass): 596 elif isinstance(self.db.classes[cn], hyperdb.FileClass):
597 if id is not None and id.startswith('-'): 597 # Avoid emptying the file
598 if not props.get('content', ''): 598 if props.has_key('content') and not props['content']:
599 del all_props[(cn, id)] 599 del props ['content']
600 elif props.has_key('content') and not props['content']:
601 raise FormError (self._('File is empty'))
602 return all_props, all_links 600 return all_props, all_links
603 601
604 def parse_file(self, fpropdef, fprops, v): 602 def parse_file(self, fpropdef, fprops, v):
605 # try to determine the file content-type 603 # try to determine the file content-type
606 fn = v.filename.split('\\')[-1] 604 fn = v.filename.split('\\')[-1]

Roundup Issue Tracker: http://roundup-tracker.org/