From 5b17355142873d7c4a1cb1116aa4ed03a27d0782 Mon Sep 17 00:00:00 2001 From: Lakshmi Vyasarajan Date: Tue, 15 Mar 2011 14:38:32 +0530 Subject: [PATCH] Removed regeneration on file not found. Fixed refresh param handling --- hyde/server.py | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/hyde/server.py b/hyde/server.py index 0beaaca..961ede8 100644 --- a/hyde/server.py +++ b/hyde/server.py @@ -37,11 +37,13 @@ class HydeRequestHandler(SimpleHTTPRequestHandler): logger.info("Processing request:[%s]" % self.path) result = urlparse.urlparse(self.path) query = urlparse.parse_qs(result.query) - if 'refresh' in query: + if 'refresh' in query or result.query=='refresh': self.server.regenerate() - del query['refresh'] - parts = tuple(result) + if 'refresh' in query: + del query['refresh'] + parts = list(tuple(result)) parts[4] = urllib.urlencode(query) + parts = tuple(parts) new_url = urlparse.urlunparse(parts) logger.info('Redirecting...[%s]' % new_url) self.redirect(new_url) @@ -70,19 +72,7 @@ class HydeRequestHandler(SimpleHTTPRequestHandler): res = site.content.resource_from_relative_deploy_path(path) if not res: - # Check if its a new request - if self.server.request_time > self.server.regeneration_time: - # Cannot find the source file using the given path. - # Check if the target file exists in the deploy folder. - - # this file is probably new or being generated by a plugin. - # lets not try too hard, just regenerate - logger.info("Attempting regeneration for:[%s]" % path) - self.server.regenerate() - res = site.content.resource_from_relative_deploy_path(path) - if not res: - # Nothing much we can do. - logger.error("Cannot load file:[%s]" % path) + logger.error("Cannot load file:[%s]" % path) return site.config.deploy_root_path.child(path) else: @@ -183,7 +173,7 @@ class HydeWebServer(HTTPServer): logger.info('Regenerating the entire site') self.regeneration_time = datetime.now() self.site.load() - self.generator.generate_all() + self.generator.generate_all(incremental=False) except Exception, exception: logger.error('Error occured when regenerating the site [%s]' % exception.message)