def publish_collated_document(cursor, model, parent_model):
html = bytes(cnxepub.DocumentContentFormatter(model))<EOL>sha1 = hashlib.new('<STR_LIT>', html).hexdigest()<EOL>cursor.execute("<STR_LIT>", (sha1,))<EOL>try:<EOL><INDENT>fileid = cursor.fetchone()[<NUM_LIT:0>]<EOL><DEDENT>except TypeError:<EOL><INDENT>file_args = {<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT:data>': psycopg2.Binary(html),<EOL>}<EOL>cursor.execute("""<STR_LIT>""", file_args)<EOL>fileid = cursor.fetchone()[<NUM_LIT:0>]<EOL><DEDENT>args = {<EOL>'<STR_LIT>': model.ident_hash,<EOL>'<STR_LIT>': parent_model.ident_hash,<EOL>'<STR_LIT>': fileid,<EOL>}<EOL>stmt = """<STR_LIT>"""<EOL>cursor.execute(stmt, args)<EOL>
Publish a given `module`'s collated content in the context of
    the `parent_model`. Note, the model's content is expected to already
    have the collated content. This will just persist that content to
    the archive.