3
VmW~                 @   s   d Z ddlmZmZ ddlZddlmZmZm	Z	m
Z
 ddlmZ eeZejjejdZejjejdZejjejdZd	Zejd
dd Zejddd Zedkrejddd dS )aD  
    weasyprint.tests.test_web.run
    -----------------------------

    A simple web application made with Flask. Allows to type HTML
    and instantly visualize the result rendered by WeasyPrint.

    :copyright: Copyright 2011-2014 Simon Sapin and contributors, see AUTHORS.
    :license: BSD, see LICENSE for details.

    )divisionunicode_literalsN)Flaskrequestrender_template	send_file)HTMLz
input.htmlz
output.pngz
output.pdfz
<style>
body { margin: 1em 2em; }
h1 { text-decoration : underline; }
div { border: 10px solid; background: #ddd; }
</style>

<h1>Weasyprint testing</h1>

<div><ul><li>Hello, world!
/c              C   sD   t jjtr4tt} | j jdp&t}W d Q R X nt}td|dS )Nzutf-8zindex.html.jinja2)content)	ospathisfileINPUTopenreaddecodeDEFAULT_CONTENTr   )fdr
    r   ]/var/www/html/enquirykeeper_venv/lib/python3.6/site-packages/weasyprint/tests/test_web/run.pyindex)   s
    
r   z/render.pngc              C   sx   t jd } | j st| rLd| ks&tttd}|j| jd W d Q R X ttdd} | j	t
 | jt ttddS )	NhtmlZfuuwzutf-8utf8)encodingr   )Zcache_timeout)r   argsstripAssertionErrorr   r   writeencoder   Z	write_pdf
PDF_OUTPUTZ	write_png
PNG_OUTPUTr   )r   r   r   r   r   render3   s    


r"   __main__i0  T)portdebug)__doc__
__future__r   r   os.pathr   Zflaskr   r   r   r   
weasyprintr   __name__Zappr   joinZ	root_pathr   r!   r    r   Zrouter   r"   runr   r   r   r   <module>   s   
