Skip to content

Commit c91f209

Browse files
committed
- Added 'favicon.ico'.
- Modified the webserver to serve the icon on request.
1 parent 5f9ce7b commit c91f209

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

favicon.ico

1.37 KB
Binary file not shown.

run-webserver.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ def handle_command(self, path, query, content):
130130
self.WriteChunk(chunk1)
131131
self.WriteChunk(chunk2)
132132
self.WriteChunk()
133-
else:
133+
elif path.endswith(".ico") != ".": # EXPLICIT BINARY FILES
134+
self.wfile.write(body)
135+
else: # TEXT
134136
self.wfile.write(body.encode('ascii','xmlcharrefreplace'))
135137
else:
136138
# Page not found.
@@ -264,6 +266,11 @@ def table_row_link(table_name, row_id):
264266
return "<a href='/row?table=%s&row_id=%s'>%s</a>" % (table_name, row_id, row_id)
265267

266268

269+
def icon_fetcher(handler, path, kwargs):
270+
return open("favicon.ico", "rb").read()
271+
272+
RequestHandler.page_handlers["/favicon.ico"] = icon_fetcher
273+
267274
def page_view_row(handler, path, kwargs):
268275
# /row?table=<table_name>&row_id=<row_id>
269276
table_name = kwargs["table"][0]

0 commit comments

Comments
 (0)