Rhys ! committed bae075a

moved nice 404 error to new errors module

Comments (0)

Files changed (3)


 from urllib import unquote
-from rgframe.handler import errors
+from ..errors import not_found_nice
 from ..handler import Handler
 from ..templates import templates
 from ..models import Post as PostModel
         if not author:
             author = AuthorModel.get_by_name(g)
             if not author:
-                raise self.nice_404()
+                raise not_found_nice(self)
         template = templates.list
         template.of = "Posts by %s" %
         if groups[0].isdigit():
             post = PostModel.get_by_id(int(groups[0]))
             if not post:
-                raise self.nice_404()
+                raise not_found_nice(self)
-            raise self.nice_404()
+            raise not_found_nice(self)
         template = templates.view_post = post
+from rgframe.handler import errors
+from templates import templates
+def not_found_nice(handler):
+    return errors.not_found(headers={
+            'Content-Type': 'text/html' if handler.client_is_ie else 'application/xhtml+xml'
+        }, message=handler.render_template(templates.not_found))
 from rgframe.handler.http import Handler as HttpHandler
-from rgframe.handler import errors
 from users import current_user
-from templates import templates
 class Handler(HttpHandler):
             type = 'text/html'
         self.reply(code=code, data=self.render_template(template), headers={'Content-Type': type}, cache=cache)
-    def nice_404(self):
-        return errors.not_found(mimetype='text/html' if self.client_is_ie else 'application/xhtml+xml', message=self.render_template(templates.not_found))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.