constance

Scripts for generating (an earlier obsolete version of) my personal web site
git clone https://code.djc.id.au/git/constance/
commit b16a5a777b6b052e140f3c5e9e2de7e0f50bd09f
parent 9cb2251380baf1a13955869592e4bd6c6f769d82
Author: Dan Callaghan <djc@djc.id.au>
Date:   Tue, 16 Sep 2008 02:12:03 +1000

return 404 for non-existent posts

Diffstat:
Mapp.py | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/app.py b/app.py
@@ -69,14 +69,14 @@ class Constance(RegexApplication):
         id = id.decode(self.charset) # shouldn't Colubrid do this?
         try:
             entry = self.blog_entries[id]
-            rendered = template_loader.load('single.xml').generate(
-                    config=self.config, 
-                    environ=self.request.environ, 
-                    entry=entry
-                    ).render('xhtml')
-            return HttpResponse(rendered, [('Content-Type', 'text/html')], 200)
-        except blog.EntryNotFoundError:
+        except KeyError:
             raise PageNotFound()
+        rendered = template_loader.load('single.xml').generate(
+                config=self.config, 
+                environ=self.request.environ, 
+                entry=entry
+                ).render('xhtml')
+        return HttpResponse(rendered, [('Content-Type', 'text/html')], 200)
     
     def add_post_comment(self, id):
         id = id.decode(self.charset) # shouldn't Colubrid do this?