@view_config(route_name='<STR_LIT>', request_method='<STR_LIT:POST>', renderer='<STR_LIT>',<EOL>permission='<STR_LIT>', http_cache=<NUM_LIT:0>)<EOL>def publish(request):
if '<STR_LIT>' not in request.POST:<EOL><INDENT>raise httpexceptions.HTTPBadRequest("<STR_LIT>")<EOL><DEDENT>is_pre_publication = asbool(request.POST.get('<STR_LIT>'))<EOL>epub_upload = request.POST['<STR_LIT>'].file<EOL>try:<EOL><INDENT>epub = cnxepub.EPUB.from_file(epub_upload)<EOL><DEDENT>except:  <EOL><INDENT>raise httpexceptions.HTTPBadRequest('<STR_LIT>')<EOL><DEDENT>with db_connect() as db_conn:<EOL><INDENT>with db_conn.cursor() as cursor:<EOL><INDENT>epub_upload.seek(<NUM_LIT:0>)<EOL>publication_id, publications = add_publication(<EOL>cursor, epub, epub_upload, is_pre_publication)<EOL><DEDENT><DEDENT>state, messages = poke_publication_state(publication_id)<EOL>response_data = {<EOL>'<STR_LIT>': publication_id,<EOL>'<STR_LIT>': publications,<EOL>'<STR_LIT:state>': state,<EOL>'<STR_LIT>': messages,<EOL>}<EOL>return response_data<EOL>
Accept a publication request at form value 'epub