Commit eb243fec authored by Jérome Perrin's avatar Jérome Perrin

report type errors in deleteContent


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3656 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6804aa15
...@@ -80,16 +80,21 @@ class FolderMixIn(ExtensionClass.Base): ...@@ -80,16 +80,21 @@ class FolderMixIn(ExtensionClass.Base):
if immediate_reindex: new_instance.immediateReindexObject() if immediate_reindex: new_instance.immediateReindexObject()
return new_instance return new_instance
security.declareProtected(Permissions.DeletePortalContent, 'deleteContent') security.declareProtected(
Permissions.DeletePortalContent, 'deleteContent')
def deleteContent(self, id): def deleteContent(self, id):
# id is string or list """ delete items in this folder.
# XXX should raise error if not `id` can be a list or a string.
"""
if type(id) is type(''): if type(id) is type(''):
self._delObject(id) self._delObject(id)
elif type(id) is type([]) or type(id) is type(()): elif type(id) is type([]) or type(id) is type(()):
for my_id in id: for my_id in id:
self._delObject(my_id) self._delObject(my_id)
else:
raise TypeError, 'deleteContent only accepts string or list, '\
'not %s' % type(id)
# Automatic ID Generation method # Automatic ID Generation method
security.declareProtected(Permissions.View, 'generateNewId') security.declareProtected(Permissions.View, 'generateNewId')
def generateNewId(self,id_group=None,default=None,method=None): def generateNewId(self,id_group=None,default=None,method=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment