Permalink
Browse files

Add a favicon for the Browser. (Clients keep requesting it…)

  • Loading branch information...
SimonSapin committed Jun 15, 2012
1 parent b276dbd commit 8b38b39fa25bd49383ee7ea8ceec7714628e8623
Showing with 7 additions and 2 deletions.
  1. +7 −2 weasyprint/browser.py
  2. BIN weasyprint/tests/resources/icon.png
View
@@ -13,6 +13,7 @@
from __future__ import division, unicode_literals
import io
+import os.path
import cairo
@@ -22,6 +23,10 @@
from weasyprint.urls import url_is_absolute
+FAVICON = os.path.join(os.path.dirname(__file__),
+ 'tests', 'resources', 'icon.png')
+
+
def find_links(box, links, anchors):
link = box.style.link
# 'link' is inherited but redundant on text boxes
@@ -72,7 +77,7 @@ def get_svg_pages(html, *stylesheets):
def make_app():
# Keep here imports that are not required for the rest of WeasyPrint
- from flask import Flask, request
+ from flask import Flask, request, send_file
from jinja2 import Template
app = Flask(__name__)
@@ -128,7 +133,7 @@ def make_app():
@app.route('/favicon.ico')
def favicon():
- return 'No favicon yet.', 404
+ return send_file(FAVICON)
@app.route('/')
@app.route('/<path:url>')
Binary file not shown.

0 comments on commit 8b38b39

Please sign in to comment.