Permalink
Browse files

Merge pull request #9 from axitkhurana/hackweek

custom 404 page with JSON request support
  • Loading branch information...
2 parents c07821a + 685e854 commit 89033d7ee61fb81146583ff1af09ead8a43fe68f @mapleoin committed Sep 21, 2012
Showing with 19 additions and 0 deletions.
  1. +11 −0 popcorn/templates/error.html
  2. +8 −0 popcorn/views.py
@@ -0,0 +1,11 @@
+{% extends 'layout.html' %}
+
+{% block content %}
+{% filter textile %}
+
+h2. {{ error }}
+
+Try going to our "homepage":{{ url_for('index') }}.
+
+{% endfilter %}
+{% endblock %}
View
@@ -216,3 +216,11 @@ def download():
def faq():
"""Frequently asked questions"""
pass
+
+
+@app.errorhandler(404)
+@render(template='error.html')
+def not_found(error):
+ """Handle page not found error"""
+ error_msg = "Not Found"
+ return dict(error=error_msg, code=404, request=request.path)

0 comments on commit 89033d7

Please sign in to comment.