'Fills in a new document using the Application\'s handlers.'

def initialize_document(self, doc):

    for h in self._handlers:
        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()
