# HG changeset patch # User Sylvain Thénault # Date 1309860593 -7200 # Node ID 0d0344fd523155f7cf6bfcf33bd4dc1b94788da9 # Parent 5395007c415c6249d38b84a4b80709f1db4b80bf [etwist] clear ui cache at server startup time. Closes #1806933 this avoid pb when cubicweb/cubes provide new version of some js/css and also accumulating junk in the cache directories diff -r 5395007c415c -r 0d0344fd5231 etwist/server.py --- a/etwist/server.py Tue Jul 05 10:54:52 2011 +0200 +++ b/etwist/server.py Tue Jul 05 12:09:53 2011 +0200 @@ -174,7 +174,9 @@ def __init__(self, config, paths): _, ext = osp.splitext(paths[0]) self._resources = {} - # create a unique / predictable filename + # create a unique / predictable filename. We don't consider cubes + # version since uicache is cleared at server startup, and file's dates + # are checked in debug mode fname = 'cache_concat_' + hashlib.md5(';'.join(paths)).hexdigest() + ext filepath = osp.join(config.appdatahome, 'uicache', fname) LongTimeExpiringFile.__init__(self, config, filepath) @@ -223,6 +225,7 @@ return False return True + class CubicWebRootResource(resource.Resource): def __init__(self, config, vreg=None): resource.Resource.__init__(self) diff -r 5395007c415c -r 0d0344fd5231 etwist/twctl.py --- a/etwist/twctl.py Tue Jul 05 10:54:52 2011 +0200 +++ b/etwist/twctl.py Tue Jul 05 12:09:53 2011 +0200 @@ -17,6 +17,10 @@ # with CubicWeb. If not, see . """cubicweb-clt handlers for twisted""" +from os.path import join + +from logilab.common.shellutils import rm + from cubicweb.toolsutils import CommandHandler from cubicweb.web.webctl import WebCreateHandler @@ -32,6 +36,9 @@ def start_server(self, config): from cubicweb.etwist import server + config.info('clear ui caches') + for cachedir in ('uicache', 'uicachehttps'): + rm(join(config.appdatahome, cachedir, '*')) return server.run(config) class TWStopHandler(CommandHandler):