@@ -793,10 +793,11 @@ def delete(self, items: list) -> None:
793793 ----------
794794 items : list
795795 List of objects to delete. The objects can be of one of these types:
796- ``"Item"``, ``"Session"``, or ``Dataset``.
796+ ``"Item"``, ``Report``, `` "Session"`` or ``Dataset``.
797797
798798 .. note:: Deleting a session or a dataset also deletes all items
799- associated with the session or dataset.
799+ associated with the session or dataset. Deleting a Report also
800+ deletes all its children.
800801
801802 Examples
802803 --------
@@ -807,13 +808,21 @@ def delete(self, items: list) -> None:
807808 adr_service.connect(url='http://localhost:8020')
808809 all_items = adr_service.query(type='Item')
809810 adr_service.delete(all_items)
811+ my_report = adr_service.get_report(report_name='My Report')
812+ adr_service.delete([my_report])
810813 """
811814 if type (items ) is not list :
812815 self .logger .error ("Error: passed argument is not a list" )
813816 raise TypeError
814817 items_to_delete = [x .item for x in items if type (x ) is Item ]
818+ reports_to_delete = [x for x in items if type (x ) is Report ]
819+ if reports_to_delete :
820+ self .logger .warning (
821+ "Warning: Report deletion will result in deletion of " "all its children templates"
822+ )
823+ items_to_delete .extend ([x .report for x in reports_to_delete ])
815824 # Check the input
816- not_items = [x for x in items if type (x ) is not Item ]
825+ not_items = [x for x in items if ( type (x ) is not Item ) and ( type ( x ) is not Report ) ]
817826 if not_items : # pragma: no cover
818827 session = [x for x in not_items if type (x ) is report_objects .SessionREST ]
819828 if session :
0 commit comments