parameters: (self, assessment)
docstring: Remove captures and local captures upon assessment deletion
docstring_summary: Remove captures and local captures upon assessment deletion
docstring_tokens: Remove captures and local captures upon assessment deletion
function: def delete_captures(self, assessment):
          """
          Remove captures and local captures upon assessment deletion
          """
          cascaded_captures = Capture.query.filter_by(
              assessment=assessment.name).all()
  
          for capture in cascaded_captures:
              try:
                  os.remove("uploads/{}.png".format(capture.screenshot))
                  os.remove(
                      "uploads/small_{}.png".format(capture.screenshot))
              except:
                  pass
          try:
              # Cascade delete for Assessment
              Capture.query.filter_by(assessment=assessment.name).delete()
              AccessLog.query.filter_by(assessment=assessment.name).delete()
              GenericCollector.query.filter_by(assessment=assessment.name).delete()
          except Exception as err:
              app.logger.warn(err)
  
          try:
              db.session.commit()
          except Exception as err:
              app.logger.warn(err)
function_tokens: def delete_captures ( self , assessment ) : cascaded_captures = Capture . query . filter_by ( assessment = assessment . name ) . all ( ) for capture in cascaded_captures : try : os . remove ( "uploads/{}.png" . format ( capture . screenshot ) ) os . remove ( "uploads/small_{}.png" . format ( capture . screenshot ) ) except : pass try : # Cascade delete for Assessment Capture . query . filter_by ( assessment = assessment . name ) . delete ( ) AccessLog . query . filter_by ( assessment = assessment . name ) . delete ( ) GenericCollector . query . filter_by ( assessment = assessment . name ) . delete ( ) except Exception as err : app . logger . warn ( err ) try : db . session . commit ( ) except Exception as err : app . logger . warn ( err )