@@ -2211,18 +2211,24 @@ def has_broken_documents(self) -> bool:
22112211 Returns:
22122212 bool: True if any document or nested bundle has broken content.
22132213 """
2214+ return len (self .broken_exhibit_titles ()) > 0
2215+
2216+ def broken_exhibit_titles (self ) -> List [str ]:
2217+ """
2218+ Returns the titles of any broken exhibits in this bundle, including
2219+ ones inside nested bundles.
2220+
2221+ Returns:
2222+ List[str]: Titles of exhibits that will be skipped.
2223+ """
2224+ titles : List [str ] = []
22142225 for document in self .enabled_documents ():
2215- if (
2216- hasattr (document , "has_broken_exhibits" )
2217- and document .has_broken_exhibits ()
2218- ):
2219- return True
2220- if (
2221- isinstance (document , ALDocumentBundle )
2222- and document .has_broken_documents ()
2223- ):
2224- return True
2225- return False
2226+ if hasattr (document , "broken_exhibits" ):
2227+ for exhibit in document .broken_exhibits ():
2228+ titles .append (getattr (exhibit , "title" , None ) or "an exhibit" )
2229+ if isinstance (document , ALDocumentBundle ):
2230+ titles .extend (document .broken_exhibit_titles ())
2231+ return titles
22262232
22272233 def broken_documents_warning_html (self ) -> str :
22282234 """
@@ -2232,14 +2238,15 @@ def broken_documents_warning_html(self) -> str:
22322238 Returns:
22332239 str: The warning HTML, or an empty string if nothing is broken.
22342240 """
2235- if not self .has_broken_documents ():
2241+ broken_titles = self .broken_exhibit_titles ()
2242+ if not broken_titles :
22362243 return ""
2237- return (
2238- '<div class="alert alert-warning" role="alert">'
2239- "One of your files did not upload correctly and it will not be included. "
2240- "Please try uploading it again before you continue."
2241- "</div> "
2242- )
2244+ quoted = [ f'" { escape ( title ) } "' for title in broken_titles ]
2245+ if len ( quoted ) == 1 :
2246+ message = f" { quoted [ 0 ] } did not upload correctly and won't be included. Please try uploading it again before you continue. "
2247+ else :
2248+ message = f" { ', ' . join ( quoted [: - 1 ]) } and { quoted [ - 1 ] } didn't upload correctly and won't be included. Please try uploading them again before you continue. "
2249+ return f'<div class="alert alert-warning" role="alert"> { message } </div>'
22432250
22442251 def download_list_html (
22452252 self ,
0 commit comments