[windows service] Copied the 3 lines from etwist/twctl into etwist/service in order to also clean the cache in Windows service mode. stable
authorpatwat
Wed, 08 Feb 2012 14:32:35 +0100
branchstable
changeset 8200 182d47d87a5c
parent 8199 fb5c0e60a615
child 8201 2ceb28e6aa76
[windows service] Copied the 3 lines from etwist/twctl into etwist/service in order to also clean the cache in Windows service mode. Could be factorised with etwist/server.run
etwist/service.py
--- a/etwist/service.py	Wed Feb 08 14:22:48 2012 +0100
+++ b/etwist/service.py	Wed Feb 08 14:32:35 2012 +0100
@@ -25,9 +25,12 @@
     print 'Win32 extensions for Python are likely not installed.'
     sys.exit(3)
 
+from os.path import join
 
 from cubicweb.etwist.server import (CubicWebRootResource, reactor, server)
 
+from logilab.common.shellutils import rm
+
 import logging
 from logging import getLogger, handlers
 from cubicweb import set_log_methods
@@ -74,6 +77,9 @@
             config.init_log(force=True)
             config.debugmode = False
             logger.info('starting cubicweb instance %s ', self.instance)
+            config.info('clear ui caches')
+            for cachedir in ('uicache', 'uicachehttps'):
+                rm(join(config.appdatahome, cachedir, '*'))
             root_resource = CubicWebRootResource(config)
             website = server.Site(root_resource)
             # serve it via standard HTTP on port set in the configuration