code: def initialize_document(self, doc):
          ''' 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(f initialize_document(self, doc):
          ''' 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()
docs: Fills in a new document using the Application's handlers.