# HG changeset patch # User Ludovic Chabant # Date 1413504222 25200 # Node ID 208c652551a3e56944aee73762f5846bace017f2 # Parent 7f00176a3b4d77b7fb9c4db75828dad2f03f9ed9 Quick fix for making the server correctly update referenced pages. Disable the file-system cache for rendered segments when in server mode. We can bring this optimization back when we're actually using the baking record in the server too in order to know dependencies. diff -r 7f00176a3b4d -r 208c652551a3 piecrust/environment.py --- a/piecrust/environment.py Thu Oct 16 08:19:02 2014 -0700 +++ b/piecrust/environment.py Thu Oct 16 17:03:42 2014 -0700 @@ -115,11 +115,14 @@ self.was_cache_cleaned = False self.page_repository = MemCache() self.rendered_segments_repository = MemCache() + self.fs_caches = { + 'renders': self.rendered_segments_repository} self.base_asset_url_format = '%uri%' def initialize(self, app): - cache = app.cache.getCache('renders') - self.rendered_segments_repository.fs_cache = cache + for name, repo in self.fs_caches.items(): + cache = app.cache.getCache(name) + repo.fs_cache = cache class StandardEnvironment(Environment): diff -r 7f00176a3b4d -r 208c652551a3 piecrust/serving.py --- a/piecrust/serving.py Thu Oct 16 08:19:02 2014 -0700 +++ b/piecrust/serving.py Thu Oct 16 17:03:42 2014 -0700 @@ -15,6 +15,7 @@ from piecrust.app import PieCrust from piecrust.data.filters import (PaginationFilter, HasFilterClause, IsFilterClause) +from piecrust.environment import StandardEnvironment from piecrust.page import Page from piecrust.processing.base import ProcessorPipeline from piecrust.rendering import PageRenderingContext, render_page @@ -24,6 +25,12 @@ logger = logging.getLogger(__name__) +class ServingEnvironment(StandardEnvironment): + def __init__(self): + super(ServingEnvironment, self).__init__() + del self.fs_caches['renders'] + + class Server(object): def __init__(self, root_dir, host='localhost', port='8080', debug=False, static_preview=True, @@ -77,7 +84,8 @@ raise MethodNotAllowed() # Create the app for this request. - app = PieCrust(root_dir=self.root_dir, debug=self.debug) + env = ServingEnvironment() + app = PieCrust(root_dir=self.root_dir, debug=self.debug, env=env) app.config.set('site/root', '/') app.config.set('site/pretty_urls', True) app.config.set('server/is_serving', True)