ClearData.py 490 Bytes
Newer Older
Jean-Paul Smets's avatar
Jean-Paul Smets committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
def clearData(self,REQUEST=None):
  """
  this allows to erase every data object
  """
  context=self
  for folder in context.objectValues(("ERP5 Folder",)):
    print "#### Deleting inside the folder %s ####" % folder.id
    # Getting the list of ids
    to_delete_list = folder.objectIds()
    while len(to_delete_list) > 0:
      for id in to_delete_list:
        folder.manage_delObjects(id)
      to_delete_list = folder.objectIds()
    get_transaction().commit()

  print "work done"