class_docstr: An Application is a factory for Document instances.
  
      
class_docstr_tok: ["An","Application","is","a","factory","for","Document","instances","."]
docstr: Fills in a new document using the Application's handlers.
  
          
docstr_tok: ["Fills","in","a","new","document","using","the","Application","'s","handlers","."]
code: def initialize_document(self, doc: Document) -> None:
      """Fills in a new document using the Application's handlers."""
      for h in self._handlers:
          # TODO (havocp) we need to check the 'failed' flag on each handler
          # and build a composite error display. In develop mode, we want to
          # somehow get these errors to the client.
          h.modify_document(doc)
          if h.failed:
              log.error(
                  "Error running application handler %r: %s %s ",
                  h,
                  h.error,
                  h.error_detail,
              )
  
      if settings.perform_document_validation():
          doc.validate()
  
imports: from __future__ import annotations
  import logging
  from abc import ABCMeta, abstractmethod
  from typing import TYPE_CHECKING, Any, Awaitable, Callable, ClassVar
  from ..core.types import ID
  from ..document import Document
  from ..settings import settings
label_desc: Use image node_id 8 for calling the Application obj's underlying member method code with example usage: obj.initialize_document(doc) without return types