# HG changeset patch
# User patwat
# Date 1328707955 -3600
# Node ID 182d47d87a5cbc90bda51670aae38bd17b2b9ae4
# Parent  fb5c0e60a615e6e49a6fd85f4079351709250df7
[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

diff -r fb5c0e60a615 -r 182d47d87a5c 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