Browse Source

Exception handling fixes in server

main
Lakshmi Vyasarajan 14 years ago
parent
commit
8ef575f57d
2 changed files with 13 additions and 1 deletions
  1. +6
    -0
      hyde/generator.py
  2. +7
    -1
      hyde/server.py

+ 6
- 0
hyde/generator.py View File

@@ -111,6 +111,12 @@ class Generator(object):
self.events.generation_complete() self.events.generation_complete()


def has_resource_changed(self, resource): def has_resource_changed(self, resource):
"""
Checks if the given resource has changed since the
last generation.
"""
self.load_site_if_needed()
self.load_template_if_needed()
target = File(self.site.config.deploy_root_path.child( target = File(self.site.config.deploy_root_path.child(
resource.relative_deploy_path)) resource.relative_deploy_path))
if not target.exists or target.older_than(resource.source_file): if not target.exists or target.older_than(resource.source_file):


+ 7
- 1
hyde/server.py View File

@@ -46,7 +46,13 @@ class HydeRequestHandler(SimpleHTTPRequestHandler):
site = self.server.site site = self.server.site
res = site.content.resource_from_relative_path( res = site.content.resource_from_relative_path(
site.config.not_found) site.config.not_found)
self.redirect("/" + res.relative_deploy_path)
if not res:
logger.error(
"Cannot find the 404 template[%s]."
% site.config.not_found)
return "Requested resource not found"
else:
self.redirect("/" + res.relative_deploy_path)


def translate_path(self, path): def translate_path(self, path):
""" """


Loading…
Cancel
Save