Mercurial > p > roundup > code
diff roundup/rest.py @ 5583:c65d98a16780 REST-rebased
Added rest unit test
Fixed a bug with printing error message
Patch operation remove now replace empty list instead of None
committer: Ralf Schlatterbeck <rsc@runtux.com>
| author | Chau Nguyen <dangchau1991@yahoo.com> |
|---|---|
| date | Wed, 30 Jan 2019 10:26:35 +0100 |
| parents | 519b7fd8c8c3 |
| children | 53098db851f2 |
line wrap: on
line diff
--- a/roundup/rest.py Wed Jan 30 10:26:35 2019 +0100 +++ b/roundup/rest.py Wed Jan 30 10:26:35 2019 +0100 @@ -152,7 +152,7 @@ 'View', self.db.getuid(), class_name, itemid=item_id ): raise Unauthorised( - 'Permission to view %s item %d denied' % (class_name, item_id) + 'Permission to view %s item %s denied' % (class_name, item_id) ) class_obj = self.db.getclass(class_name) @@ -379,7 +379,11 @@ elif op == 'replace': pass elif op == 'remove': - props[prop] = None + current_prop = class_obj.get(item_id, prop) + if isinstance(current_prop, list): + props[prop] = [] + else: + props[prop] = None else: raise UsageError('PATCH Operation %s is not allowed' % op)
